]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mcb: fix incorrect sanity check
authorJose Javier Rodriguez Barbarin <dev-josejavier.rodriguez@duagon.com>
Fri, 16 Jan 2026 11:21:41 +0000 (12:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Jan 2026 14:54:09 +0000 (15:54 +0100)
__mcb_register_driver() makes some sanity checks over mcb_driver
to check if .probe and .remove callbacks are set.  However, since commit
3bd13ae04ccc ("gpio: menz127: simplify error path and remove remove()")
removed the .remove callback from menz127-gpio.c, not all mcb device
drivers implement .remove callback.

Remove .remove check to ensure all mcb device drivers can be loaded.

Signed-off-by: Jose Javier Rodriguez Barbarin <dev-josejavier.rodriguez@duagon.com>
Fixes: 3bd13ae04ccc ("gpio: menz127: simplify error path and remove remove()")
[ jth: added statement about menz127-gpio.c ]
Signed-off-by: Johannes Thumshirn <morbidrsa@gmail.com>
Link: https://patch.msgid.link/16fb55bd59d9c1d2ce2443f41d4dec2048f9a8ec.1768562302.git.jth@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mcb/mcb-core.c

index c1367223e71a0fdb3e9f735795c6b798442b15ce..3d487d75c483d7da6a4ff2ace1371d3d1a28f3bf 100644 (file)
@@ -85,7 +85,8 @@ static void mcb_remove(struct device *dev)
        struct mcb_device *mdev = to_mcb_device(dev);
        struct module *carrier_mod;
 
-       mdrv->remove(mdev);
+       if (mdrv->remove)
+               mdrv->remove(mdev);
 
        carrier_mod = mdev->dev.parent->driver->owner;
        module_put(carrier_mod);
@@ -176,13 +177,13 @@ static const struct device_type mcb_carrier_device_type = {
  * @owner: The @mcb_driver's module
  * @mod_name: The name of the @mcb_driver's module
  *
- * Register a @mcb_driver at the system. Perform some sanity checks, if
- * the .probe and .remove methods are provided by the driver.
+ * Register a @mcb_driver at the system. Perform a sanity check, if
+ * .probe method is provided by the driver.
  */
 int __mcb_register_driver(struct mcb_driver *drv, struct module *owner,
                        const char *mod_name)
 {
-       if (!drv->probe || !drv->remove)
+       if (!drv->probe)
                return -EINVAL;
 
        drv->driver.owner = owner;