diff options
| author | Uwe Kleine-König <[email protected]> | 2021-02-07 21:15:37 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2021-02-09 13:30:05 +0000 |
| commit | e5e1c209788138f33ca6558bf9f572f6904f486d (patch) | |
| tree | 3545273741bb4c9f836585d70bf209d999cf2223 /drivers/base/platform.c | |
| parent | of: property: Fix fw_devlink handling of interrupts/interrupts-extended (diff) | |
| download | kernel-e5e1c209788138f33ca6558bf9f572f6904f486d.tar.gz kernel-e5e1c209788138f33ca6558bf9f572f6904f486d.zip | |
driver core: platform: Emit a warning if a remove callback returned non-zero
The driver core ignores the return value of a bus' remove callback. However
a driver returning an error code is a hint that there is a problem,
probably a driver author who expects that returning e.g. -EBUSY has any
effect.
The right thing to do would be to make struct platform_driver::remove()
return void. With the immense number of platform drivers this is however a
big quest and I hope to prevent at least a few new drivers that return an
error code here.
Signed-off-by: Uwe Kleine-König <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/base/platform.c')
| -rw-r--r-- | drivers/base/platform.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 8456d8384ac8..e8e0a9c3991c 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -1463,13 +1463,16 @@ static int platform_remove(struct device *_dev) { struct platform_driver *drv = to_platform_driver(_dev->driver); struct platform_device *dev = to_platform_device(_dev); - int ret = 0; - if (drv->remove) - ret = drv->remove(dev); + if (drv->remove) { + int ret = drv->remove(dev); + + if (ret) + dev_warn(_dev, "remove callback returned a non-zero value. This will be ignored.\n"); + } dev_pm_domain_detach(_dev, true); - return ret; + return 0; } static void platform_shutdown(struct device *_dev) |
