ipack: Handle a driver without remove callback
authorUwe Kleine-König <uwe@kleine-koenig.org>
Sun, 7 Feb 2021 21:55:56 +0000 (22:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Feb 2021 08:48:23 +0000 (09:48 +0100)
A driver that only consumes devm-managed resources might well have no
remove callback. Additionally given that the device core ignores the return
value of ipack_bus_remove() stop returning an error code.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Link: https://lore.kernel.org/r/20210207215556.96371-2-uwe@kleine-koenig.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ipack/ipack.c

index eabc4d08792af14b3441b83220dac0fe999d412a..7de9605cac4fdd30faae21dd660421f6e40efcd4 100644 (file)
@@ -72,10 +72,9 @@ static int ipack_bus_remove(struct device *device)
        struct ipack_device *dev = to_ipack_dev(device);
        struct ipack_driver *drv = to_ipack_driver(device->driver);
 
-       if (!drv->ops->remove)
-               return -EINVAL;
+       if (drv->ops->remove)
+               drv->ops->remove(dev);
 
-       drv->ops->remove(dev);
        return 0;
 }