Re: [PATCH v2 09/22] mtd: spi-nor: Fix retlen handling in sst_write()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 10/10/2019 10:33 AM, Boris Brezillon wrote:

>>  drivers/mtd/spi-nor/spi-nor.c | 22 +++++++++++-----------
>>  1 file changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
>> index 0aee068a5835..be5dee622d51 100644
>> --- a/drivers/mtd/spi-nor/spi-nor.c
>> +++ b/drivers/mtd/spi-nor/spi-nor.c
>> @@ -2665,12 +2665,12 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
>>  		/* write one byte. */
>>  		ret = spi_nor_write_data(nor, to, 1, buf);
>>  		if (ret < 0)
>> -			goto sst_write_err;
>> +			goto unlock_and_unprep;
>>  		WARN(ret != 1, "While writing 1 byte written %i bytes\n",
>>  		     (int)ret);
>>  		ret = spi_nor_wait_till_ready(nor);
>>  		if (ret)
>> -			goto sst_write_err;
>> +			goto unlock_and_unprep;
>>  	}
>>  	to += actual;
> Not sure we need this new label, we can just have:
> 
> 	actual = 0;
> 	/* Start write from odd address. */
> 	if (to % 2) {
> 		nor->program_opcode = SPINOR_OP_BP;
> 
> 		/* write one byte. */
> 		ret = spi_nor_write_data(nor, to, 1, buf);
> 		if (ret < 0)
> 			goto out;
> 		WARN(ret != 1, "While writing 1 byte written %i
> 		bytes\n", (int)ret);
> 		ret = spi_nor_wait_till_ready(nor);
> 		if (ret)
> 			goto out;
> 
> 		to++;
> 		actual++;
> 	}
> 

nice, thanks!
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux