Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mei: bus: change remove callback to return void

The driver core ignores the return value of mei_cl_device_remove() so
passing an error value doesn't solve any problem. As most mei drivers'
remove callbacks return 0 unconditionally and returning a different value
doesn't have any effect, change this prototype to return void and return 0
unconditionally in mei_cl_device_remove(). The only driver that could
return an error value is modified to emit an explicit warning in the error
case.

Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Link: https://lore.kernel.org/r/20210208073705.428185-3-uwe@kleine-koenig.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
bf5c9cc8 f320ff03

+11 -15
+2 -3
drivers/misc/mei/bus.c
··· 881 881 { 882 882 struct mei_cl_device *cldev = to_mei_cl_device(dev); 883 883 struct mei_cl_driver *cldrv = to_mei_cl_driver(dev->driver); 884 - int ret = 0; 885 884 886 885 if (cldrv->remove) 887 - ret = cldrv->remove(cldev); 886 + cldrv->remove(cldev); 888 887 889 888 mei_cldev_unregister_callbacks(cldev); 890 889 891 890 mei_cl_bus_module_put(cldev); 892 891 module_put(THIS_MODULE); 893 892 894 - return ret; 893 + return 0; 895 894 } 896 895 897 896 static ssize_t name_show(struct device *dev, struct device_attribute *a,
+5 -2
drivers/misc/mei/hdcp/mei_hdcp.c
··· 845 845 return ret; 846 846 } 847 847 848 - static int mei_hdcp_remove(struct mei_cl_device *cldev) 848 + static void mei_hdcp_remove(struct mei_cl_device *cldev) 849 849 { 850 850 struct i915_hdcp_comp_master *comp_master = 851 851 mei_cldev_get_drvdata(cldev); 852 + int ret; 852 853 853 854 component_master_del(&cldev->dev, &mei_component_master_ops); 854 855 kfree(comp_master); 855 856 mei_cldev_set_drvdata(cldev, NULL); 856 857 857 - return mei_cldev_disable(cldev); 858 + ret = mei_cldev_disable(cldev); 859 + if (ret) 860 + dev_warn(&cldev->dev, "mei_cldev_disable() failed\n"); 858 861 } 859 862 860 863 #define MEI_UUID_HDCP GUID_INIT(0xB638AB7E, 0x94E2, 0x4EA2, 0xA5, \
+1 -3
drivers/nfc/microread/mei.c
··· 44 44 return 0; 45 45 } 46 46 47 - static int microread_mei_remove(struct mei_cl_device *cldev) 47 + static void microread_mei_remove(struct mei_cl_device *cldev) 48 48 { 49 49 struct nfc_mei_phy *phy = mei_cldev_get_drvdata(cldev); 50 50 51 51 microread_remove(phy->hdev); 52 52 53 53 nfc_mei_phy_free(phy); 54 - 55 - return 0; 56 54 } 57 55 58 56 static struct mei_cl_device_id microread_mei_tbl[] = {
+1 -3
drivers/nfc/pn544/mei.c
··· 42 42 return 0; 43 43 } 44 44 45 - static int pn544_mei_remove(struct mei_cl_device *cldev) 45 + static void pn544_mei_remove(struct mei_cl_device *cldev) 46 46 { 47 47 struct nfc_mei_phy *phy = mei_cldev_get_drvdata(cldev); 48 48 ··· 51 51 pn544_hci_remove(phy->hdev); 52 52 53 53 nfc_mei_phy_free(phy); 54 - 55 - return 0; 56 54 } 57 55 58 56 static struct mei_cl_device_id pn544_mei_tbl[] = {
+1 -3
drivers/watchdog/mei_wdt.c
··· 619 619 return ret; 620 620 } 621 621 622 - static int mei_wdt_remove(struct mei_cl_device *cldev) 622 + static void mei_wdt_remove(struct mei_cl_device *cldev) 623 623 { 624 624 struct mei_wdt *wdt = mei_cldev_get_drvdata(cldev); 625 625 ··· 636 636 dbgfs_unregister(wdt); 637 637 638 638 kfree(wdt); 639 - 640 - return 0; 641 639 } 642 640 643 641 #define MEI_UUID_WD UUID_LE(0x05B79A6F, 0x4628, 0x4D7F, \
+1 -1
include/linux/mei_cl_bus.h
··· 68 68 69 69 int (*probe)(struct mei_cl_device *cldev, 70 70 const struct mei_cl_device_id *id); 71 - int (*remove)(struct mei_cl_device *cldev); 71 + void (*remove)(struct mei_cl_device *cldev); 72 72 }; 73 73 74 74 int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,