Skip to content

Commit 0c90466

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
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
1 parent 83208e1 commit 0c90466

4 files changed

Lines changed: 9 additions & 14 deletions

File tree

drivers/mtd/hyperbus/hbmc-am654.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,16 @@ static int am654_hbmc_remove(struct platform_device *pdev)
233233
{
234234
struct am654_hbmc_priv *priv = platform_get_drvdata(pdev);
235235
struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv;
236-
int ret;
237236

238-
ret = hyperbus_unregister_device(&priv->hbdev);
237+
hyperbus_unregister_device(&priv->hbdev);
238+
239239
if (priv->mux_ctrl)
240240
mux_control_deselect(priv->mux_ctrl);
241241

242242
if (dev_priv->rx_chan)
243243
dma_release_channel(dev_priv->rx_chan);
244244

245-
return ret;
245+
return 0;
246246
}
247247

248248
static const struct of_device_id am654_hbmc_dt_ids[] = {

drivers/mtd/hyperbus/hyperbus-core.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,12 @@ int hyperbus_register_device(struct hyperbus_device *hbdev)
126126
}
127127
EXPORT_SYMBOL_GPL(hyperbus_register_device);
128128

129-
int hyperbus_unregister_device(struct hyperbus_device *hbdev)
129+
void hyperbus_unregister_device(struct hyperbus_device *hbdev)
130130
{
131-
int ret = 0;
132-
133131
if (hbdev && hbdev->mtd) {
134-
ret = mtd_device_unregister(hbdev->mtd);
132+
WARN_ON(mtd_device_unregister(hbdev->mtd));
135133
map_destroy(hbdev->mtd);
136134
}
137-
138-
return ret;
139135
}
140136
EXPORT_SYMBOL_GPL(hyperbus_unregister_device);
141137

drivers/mtd/hyperbus/rpc-if.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,12 @@ static int rpcif_hb_probe(struct platform_device *pdev)
153153
static int rpcif_hb_remove(struct platform_device *pdev)
154154
{
155155
struct rpcif_hyperbus *hyperbus = platform_get_drvdata(pdev);
156-
int error = hyperbus_unregister_device(&hyperbus->hbdev);
156+
157+
hyperbus_unregister_device(&hyperbus->hbdev);
157158

158159
rpcif_disable_rpm(&hyperbus->rpc);
159160

160-
return error;
161+
return 0;
161162
}
162163

163164
static struct platform_driver rpcif_platform_driver = {

include/linux/mtd/hyperbus.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ int hyperbus_register_device(struct hyperbus_device *hbdev);
8989
/**
9090
* hyperbus_unregister_device - deregister HyperBus slave memory device
9191
* @hbdev: hyperbus_device to be unregistered
92-
*
93-
* Return: 0 for success, others for failure.
9492
*/
95-
int hyperbus_unregister_device(struct hyperbus_device *hbdev);
93+
void hyperbus_unregister_device(struct hyperbus_device *hbdev);
9694

9795
#endif /* __LINUX_MTD_HYPERBUS_H__ */

0 commit comments

Comments
 (0)