mtd: hyperbus: Make hyperbus_unregister_device() return void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 3 Jun 2022 21:07:45 +0000 (23:07 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 9 Jun 2022 13:06:13 +0000 (15:06 +0200)
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
drivers/mtd/hyperbus/hbmc-am654.c
drivers/mtd/hyperbus/hyperbus-core.c
drivers/mtd/hyperbus/rpc-if.c
include/linux/mtd/hyperbus.h

index a3439b791eeb4901d8640700851b10de9e116df5..a6161ce340d4eb5b26a9d236721d7a6c0ac93048 100644 (file)
@@ -233,16 +233,16 @@ static int am654_hbmc_remove(struct platform_device *pdev)
 {
        struct am654_hbmc_priv *priv = platform_get_drvdata(pdev);
        struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv;
-       int ret;
 
-       ret = hyperbus_unregister_device(&priv->hbdev);
+       hyperbus_unregister_device(&priv->hbdev);
+
        if (priv->mux_ctrl)
                mux_control_deselect(priv->mux_ctrl);
 
        if (dev_priv->rx_chan)
                dma_release_channel(dev_priv->rx_chan);
 
-       return ret;
+       return 0;
 }
 
 static const struct of_device_id am654_hbmc_dt_ids[] = {
index 2f9fc4e17d53e665d2fc1b1061f32532a807f9cf..4d8047d43e48e2efb3f054ad8131ffa603f9c65c 100644 (file)
@@ -126,16 +126,12 @@ int hyperbus_register_device(struct hyperbus_device *hbdev)
 }
 EXPORT_SYMBOL_GPL(hyperbus_register_device);
 
-int hyperbus_unregister_device(struct hyperbus_device *hbdev)
+void hyperbus_unregister_device(struct hyperbus_device *hbdev)
 {
-       int ret = 0;
-
        if (hbdev && hbdev->mtd) {
-               ret = mtd_device_unregister(hbdev->mtd);
+               WARN_ON(mtd_device_unregister(hbdev->mtd));
                map_destroy(hbdev->mtd);
        }
-
-       return ret;
 }
 EXPORT_SYMBOL_GPL(hyperbus_unregister_device);
 
index 6e08ec1d4f098c806627fd75ace18ede5ad6e31d..15a0be63ede1d7369243e369fafbcdd1d833d24e 100644 (file)
@@ -153,11 +153,12 @@ static int rpcif_hb_probe(struct platform_device *pdev)
 static int rpcif_hb_remove(struct platform_device *pdev)
 {
        struct rpcif_hyperbus *hyperbus = platform_get_drvdata(pdev);
-       int error = hyperbus_unregister_device(&hyperbus->hbdev);
+
+       hyperbus_unregister_device(&hyperbus->hbdev);
 
        rpcif_disable_rpm(&hyperbus->rpc);
 
-       return error;
+       return 0;
 }
 
 static struct platform_driver rpcif_platform_driver = {
index 0ce612428aea27ac483c5dc673b29a08853bcbe6..bb6b7121a5427a851f7fe58c198c590b96cd5e0a 100644 (file)
@@ -89,9 +89,7 @@ int hyperbus_register_device(struct hyperbus_device *hbdev);
 /**
  * hyperbus_unregister_device - deregister HyperBus slave memory device
  * @hbdev: hyperbus_device to be unregistered
- *
- * Return: 0 for success, others for failure.
  */
-int hyperbus_unregister_device(struct hyperbus_device *hbdev);
+void hyperbus_unregister_device(struct hyperbus_device *hbdev);
 
 #endif /* __LINUX_MTD_HYPERBUS_H__ */