Skip to content

Commit 2759181

Browse files
andy-shevwsakernel
authored andcommitted
i2c: designware-pci: Convert to use dev_err_probe()
It's fine to call dev_err_probe() in ->probe() when error code is known. Convert the driver to use dev_err_probe(). Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 0897f17 commit 2759181

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

drivers/i2c/busses/i2c-designware-pcidrv.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -246,28 +246,24 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
246246
struct dw_pci_controller *controller;
247247
struct dw_scl_sda_cfg *cfg;
248248

249-
if (id->driver_data >= ARRAY_SIZE(dw_pci_controllers)) {
250-
dev_err(&pdev->dev, "%s: invalid driver data %ld\n", __func__,
251-
id->driver_data);
252-
return -EINVAL;
253-
}
249+
if (id->driver_data >= ARRAY_SIZE(dw_pci_controllers))
250+
return dev_err_probe(&pdev->dev, -EINVAL,
251+
"Invalid driver data %ld\n",
252+
id->driver_data);
254253

255254
controller = &dw_pci_controllers[id->driver_data];
256255

257256
r = pcim_enable_device(pdev);
258-
if (r) {
259-
dev_err(&pdev->dev, "Failed to enable I2C PCI device (%d)\n",
260-
r);
261-
return r;
262-
}
257+
if (r)
258+
return dev_err_probe(&pdev->dev, r,
259+
"Failed to enable I2C PCI device\n");
263260

264261
pci_set_master(pdev);
265262

266263
r = pcim_iomap_regions(pdev, 1 << 0, pci_name(pdev));
267-
if (r) {
268-
dev_err(&pdev->dev, "I/O memory remapping failed\n");
269-
return r;
270-
}
264+
if (r)
265+
return dev_err_probe(&pdev->dev, r,
266+
"I/O memory remapping failed\n");
271267

272268
dev = devm_kzalloc(&pdev->dev, sizeof(struct dw_i2c_dev), GFP_KERNEL);
273269
if (!dev)

0 commit comments

Comments
 (0)