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

mtd: hyperbus: Make hyperbus_unregister_device() return void

The only thing that could theoretically fail in that function is
mtd_device_unregister(). However it's not supposed to fail and when
used correctly it doesn't. So wail loudly if it does anyhow.

This matches how other drivers (e.g. nand/raw/nandsim.c) use
mtd_device_unregister().

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220603210758.148493-2-u.kleine-koenig@pengutronix.de

authored by

Uwe Kleine-König and committed by
Miquel Raynal
0c90466a 83208e10

+9 -14
+3 -3
drivers/mtd/hyperbus/hbmc-am654.c
··· 233 233 { 234 234 struct am654_hbmc_priv *priv = platform_get_drvdata(pdev); 235 235 struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv; 236 - int ret; 237 236 238 - ret = hyperbus_unregister_device(&priv->hbdev); 237 + hyperbus_unregister_device(&priv->hbdev); 238 + 239 239 if (priv->mux_ctrl) 240 240 mux_control_deselect(priv->mux_ctrl); 241 241 242 242 if (dev_priv->rx_chan) 243 243 dma_release_channel(dev_priv->rx_chan); 244 244 245 - return ret; 245 + return 0; 246 246 } 247 247 248 248 static const struct of_device_id am654_hbmc_dt_ids[] = {
+2 -6
drivers/mtd/hyperbus/hyperbus-core.c
··· 126 126 } 127 127 EXPORT_SYMBOL_GPL(hyperbus_register_device); 128 128 129 - int hyperbus_unregister_device(struct hyperbus_device *hbdev) 129 + void hyperbus_unregister_device(struct hyperbus_device *hbdev) 130 130 { 131 - int ret = 0; 132 - 133 131 if (hbdev && hbdev->mtd) { 134 - ret = mtd_device_unregister(hbdev->mtd); 132 + WARN_ON(mtd_device_unregister(hbdev->mtd)); 135 133 map_destroy(hbdev->mtd); 136 134 } 137 - 138 - return ret; 139 135 } 140 136 EXPORT_SYMBOL_GPL(hyperbus_unregister_device); 141 137
+3 -2
drivers/mtd/hyperbus/rpc-if.c
··· 153 153 static int rpcif_hb_remove(struct platform_device *pdev) 154 154 { 155 155 struct rpcif_hyperbus *hyperbus = platform_get_drvdata(pdev); 156 - int error = hyperbus_unregister_device(&hyperbus->hbdev); 156 + 157 + hyperbus_unregister_device(&hyperbus->hbdev); 157 158 158 159 rpcif_disable_rpm(&hyperbus->rpc); 159 160 160 - return error; 161 + return 0; 161 162 } 162 163 163 164 static struct platform_driver rpcif_platform_driver = {
+1 -3
include/linux/mtd/hyperbus.h
··· 89 89 /** 90 90 * hyperbus_unregister_device - deregister HyperBus slave memory device 91 91 * @hbdev: hyperbus_device to be unregistered 92 - * 93 - * Return: 0 for success, others for failure. 94 92 */ 95 - int hyperbus_unregister_device(struct hyperbus_device *hbdev); 93 + void hyperbus_unregister_device(struct hyperbus_device *hbdev); 96 94 97 95 #endif /* __LINUX_MTD_HYPERBUS_H__ */