Skip to content

Commit 9e3440d

Browse files
raagjadavUwe Kleine-König
authored andcommitted
pwm: dwc: simplify error handling
Simplify error handling in ->probe() function using dev_err_probe() helper and while at it, drop error codes from the message to prevent duplication. Signed-off-by: Raag Jadav <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent ebf2c89 commit 9e3440d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/pwm/pwm-dwc.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,14 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id)
5353
int i, ret;
5454

5555
ret = pcim_enable_device(pci);
56-
if (ret) {
57-
dev_err(dev, "Failed to enable device (%pe)\n", ERR_PTR(ret));
58-
return ret;
59-
}
56+
if (ret)
57+
return dev_err_probe(dev, ret, "Failed to enable device\n");
6058

6159
pci_set_master(pci);
6260

6361
ret = pcim_iomap_regions(pci, BIT(0), pci_name(pci));
64-
if (ret) {
65-
dev_err(dev, "Failed to iomap PCI BAR (%pe)\n", ERR_PTR(ret));
66-
return ret;
67-
}
62+
if (ret)
63+
return dev_err_probe(dev, ret, "Failed to iomap PCI BAR\n");
6864

6965
info = (const struct dwc_pwm_info *)id->driver_data;
7066

0 commit comments

Comments
 (0)