Message ID | 20220603210758.148493-3-u.kleine-koenig@pengutronix.de |
---|---|
State | New |
Headers | show |
Series | mtd: Fix platform remove callbacks to always return 0 | expand |
Hi Uwe, On 03/06/22 11:07PM, Uwe Kleine-König wrote: > The function returns zero unconditionally, so simplify to make it > obvious there is no error to handle in the callers. > > This is a preparation for making platform remove callbacks return void. Cedric recently ported the driver to SPI MEM and it has now hit the linux-next tree [0]. This driver is planned to be removed. Can you please check if the new driver has this issue, and fix it there? [0] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit?id=9c63b846e6df43e5b3d31263f7db545f32deeda3 > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > --- > drivers/mtd/spi-nor/controllers/aspeed-smc.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/mtd/spi-nor/controllers/aspeed-smc.c b/drivers/mtd/spi-nor/controllers/aspeed-smc.c > index acfe010f9dd7..bd149104533a 100644 > --- a/drivers/mtd/spi-nor/controllers/aspeed-smc.c > +++ b/drivers/mtd/spi-nor/controllers/aspeed-smc.c > @@ -399,7 +399,7 @@ static ssize_t aspeed_smc_write_user(struct spi_nor *nor, loff_t to, > return len; > } > > -static int aspeed_smc_unregister(struct aspeed_smc_controller *controller) > +static void aspeed_smc_unregister(struct aspeed_smc_controller *controller) > { > struct aspeed_smc_chip *chip; > int n; > @@ -409,13 +409,13 @@ static int aspeed_smc_unregister(struct aspeed_smc_controller *controller) > if (chip) > mtd_device_unregister(&chip->nor.mtd); > } > - > - return 0; > } > > static int aspeed_smc_remove(struct platform_device *dev) > { > - return aspeed_smc_unregister(platform_get_drvdata(dev)); > + aspeed_smc_unregister(platform_get_drvdata(dev)); > + > + return 0; > } > > static const struct of_device_id aspeed_smc_matches[] = { > -- > 2.36.1 >
Hello, On 6/7/22 11:28, Pratyush Yadav wrote: > Hi Uwe, > > On 03/06/22 11:07PM, Uwe Kleine-König wrote: >> The function returns zero unconditionally, so simplify to make it >> obvious there is no error to handle in the callers. >> >> This is a preparation for making platform remove callbacks return void. > > Cedric recently ported the driver to SPI MEM and it has now hit the > linux-next tree [0]. This driver is planned to be removed. Can you > please check if the new driver has this issue, and fix it there? > > [0] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit?id=9c63b846e6df43e5b3d31263f7db545f32deeda3 It is merged in -rc1 now : https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/spi/spi-aspeed-smc.c I think aspeed_spi_remove() does what you want there. Thanks, C. >> >> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> >> --- >> drivers/mtd/spi-nor/controllers/aspeed-smc.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/mtd/spi-nor/controllers/aspeed-smc.c b/drivers/mtd/spi-nor/controllers/aspeed-smc.c >> index acfe010f9dd7..bd149104533a 100644 >> --- a/drivers/mtd/spi-nor/controllers/aspeed-smc.c >> +++ b/drivers/mtd/spi-nor/controllers/aspeed-smc.c >> @@ -399,7 +399,7 @@ static ssize_t aspeed_smc_write_user(struct spi_nor *nor, loff_t to, >> return len; >> } >> >> -static int aspeed_smc_unregister(struct aspeed_smc_controller *controller) >> +static void aspeed_smc_unregister(struct aspeed_smc_controller *controller) >> { >> struct aspeed_smc_chip *chip; >> int n; >> @@ -409,13 +409,13 @@ static int aspeed_smc_unregister(struct aspeed_smc_controller *controller) >> if (chip) >> mtd_device_unregister(&chip->nor.mtd); >> } >> - >> - return 0; >> } >> >> static int aspeed_smc_remove(struct platform_device *dev) >> { >> - return aspeed_smc_unregister(platform_get_drvdata(dev)); >> + aspeed_smc_unregister(platform_get_drvdata(dev)); >> + >> + return 0; >> } >> >> static const struct of_device_id aspeed_smc_matches[] = { >> -- >> 2.36.1 >> >
diff --git a/drivers/mtd/spi-nor/controllers/aspeed-smc.c b/drivers/mtd/spi-nor/controllers/aspeed-smc.c index acfe010f9dd7..bd149104533a 100644 --- a/drivers/mtd/spi-nor/controllers/aspeed-smc.c +++ b/drivers/mtd/spi-nor/controllers/aspeed-smc.c @@ -399,7 +399,7 @@ static ssize_t aspeed_smc_write_user(struct spi_nor *nor, loff_t to, return len; } -static int aspeed_smc_unregister(struct aspeed_smc_controller *controller) +static void aspeed_smc_unregister(struct aspeed_smc_controller *controller) { struct aspeed_smc_chip *chip; int n; @@ -409,13 +409,13 @@ static int aspeed_smc_unregister(struct aspeed_smc_controller *controller) if (chip) mtd_device_unregister(&chip->nor.mtd); } - - return 0; } static int aspeed_smc_remove(struct platform_device *dev) { - return aspeed_smc_unregister(platform_get_drvdata(dev)); + aspeed_smc_unregister(platform_get_drvdata(dev)); + + return 0; } static const struct of_device_id aspeed_smc_matches[] = {
The function returns zero unconditionally, so simplify to make it obvious there is no error to handle in the callers. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/mtd/spi-nor/controllers/aspeed-smc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)