Patchwork mtd: m25p80: fixup device removal failure path

login
register
mail settings
Submitter Brian Norris
Date Oct. 30, 2013, 11:42 p.m.
Message ID <1383176571-28057-1-git-send-email-computersforpeace@gmail.com>
Download mbox | patch
Permalink /patch/287365/
State New
Headers show

Comments

Brian Norris - Oct. 30, 2013, 11:42 p.m.
Device removal shouls fail if MTD unregistration fails.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/mtd/devices/m25p80.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Marek Vasut - Oct. 31, 2013, 7:36 a.m.
Dear Brian Norris,

> Device removal shouls fail if MTD unregistration fails.

should ;-)

Reviewed-by: Marek Vasut <marex@denx.de>

> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
>  drivers/mtd/devices/m25p80.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 58978892c321..7eda71dbc183 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -1125,9 +1125,7 @@ static int m25p_remove(struct spi_device *spi)
>  	struct m25p	*flash = spi_get_drvdata(spi);
> 
>  	/* Clean up MTD stuff. */
> -	mtd_device_unregister(&flash->mtd);
> -
> -	return 0;
> +	return mtd_device_unregister(&flash->mtd);
>  }

Best regards,
Marek Vasut
Brian Norris - Oct. 31, 2013, 2:27 p.m.
On Thu, Oct 31, 2013 at 3:36 AM, Marek Vasut <marex@denx.de> wrote:
>> Device removal shouls fail if MTD unregistration fails.
>
> should ;-)

Wow... I need to proofread myself a bit better. Thanks.

> Reviewed-by: Marek Vasut <marex@denx.de>

Fixed and pushed to l2-mtd.git.

Brian

Patch

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 58978892c321..7eda71dbc183 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -1125,9 +1125,7 @@  static int m25p_remove(struct spi_device *spi)
 	struct m25p	*flash = spi_get_drvdata(spi);
 
 	/* Clean up MTD stuff. */
-	mtd_device_unregister(&flash->mtd);
-
-	return 0;
+	return mtd_device_unregister(&flash->mtd);
 }