lkml.org 
[lkml]   [2018]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH -next] mtd: spinand: Fix error return code in spinand_init()
On Wed, 4 Jul 2018 08:34:58 +0000
Wei Yongjun <weiyongjun1@huawei.com> wrote:

> Fix to return error code -ENOMEM from the kzalloc() error handling
> case instead of 0, as done elsewhere in this function.
>
> Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>

> ---
> drivers/mtd/nand/spi/core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index 17d207a..011683e 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -985,8 +985,10 @@ static int spinand_init(struct spinand_device *spinand)
> spinand->databuf = kzalloc(nanddev_page_size(nand) +
> nanddev_per_page_oobsize(nand),
> GFP_KERNEL);
> - if (!spinand->databuf)
> + if (!spinand->databuf) {
> + ret = -ENOMEM;
> goto err_free_bufs;
> + }
>
> spinand->oobbuf = spinand->databuf + nanddev_page_size(nand);
>

\
 
 \ /
  Last update: 2018-07-04 10:28    [W:0.036 / U:0.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site