[PATCH] mtd: m25p80: handle failed spi_write in m25p80_erase

Brian Norris computersforpeace at gmail.com
Fri Nov 20 18:28:36 EST 2015


On Wed, Oct 07, 2015 at 09:52:45PM +0200, Heiner Kallweit wrote:
> Return an error if spi_write fails.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1 at 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 634b0c4..f10daa8 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -171,9 +171,7 @@ static int m25p80_erase(struct spi_nor *nor, loff_t offset)
>  	flash->command[0] = nor->erase_opcode;
>  	m25p_addr2cmd(nor, offset, flash->command);
>  
> -	spi_write(flash->spi, flash->command, m25p_cmdsz(nor));
> -
> -	return 0;
> +	return spi_write(flash->spi, flash->command, m25p_cmdsz(nor));
>  }
>  
>  /*

m25p80_erase() has been dropped, as it can be implemented in spi-nor.c,
with calls only to ->write_reg(). This error handling is done correctly
there. See:

cd78ea02dc82 ("mtd: m25p80: drop erase() callback")
c67cbb839da9 ("mtd: spi-nor: provide default erase_sector implementation")

Brian



More information about the linux-mtd mailing list