Skip to content

Commit da71bd3

Browse files
ktbowmandavejiang
authored andcommitted
PCI/AER: Use guard() in cxl_rch_handle_error_iter()
cxl_rch_handle_error_iter() includes a call to device_lock() using a goto for multiple return paths. Improve readability and maintainability by using the guard() lock variant. Signed-off-by: Terry Bowman <terry.bowman@amd.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/20260114182055.46029-13-terry.bowman@amd.com Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 5901002 commit da71bd3

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/pci/pcie/aer_cxl_rch.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data)
4242
if (!is_cxl_mem_dev(dev) || !cxl_error_is_native(dev))
4343
return 0;
4444

45-
device_lock(&dev->dev);
45+
guard(device)(&dev->dev);
4646

4747
err_handler = dev->driver ? dev->driver->err_handler : NULL;
4848
if (!err_handler)
49-
goto out;
49+
return 0;
5050

5151
if (info->severity == AER_CORRECTABLE) {
5252
if (err_handler->cor_error_detected)
@@ -57,8 +57,6 @@ static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data)
5757
else if (info->severity == AER_FATAL)
5858
err_handler->error_detected(dev, pci_channel_io_frozen);
5959
}
60-
out:
61-
device_unlock(&dev->dev);
6260
return 0;
6361
}
6462

0 commit comments

Comments
 (0)