[PATCH v2 09/22] mtd: spi-nor: Fix retlen handling in sst_write()
Tudor.Ambarus at microchip.com
Tudor.Ambarus at microchip.com
Fri Oct 25 18:34:30 AEDT 2019
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!
More information about the Linux-aspeed
mailing list