linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] mtd: spinand: Fix error return code in spinand_init()
@ 2018-07-04  8:34 Wei Yongjun
  2018-07-04  8:28 ` Boris Brezillon
  2018-07-08 21:49 ` Miquel Raynal
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2018-07-04  8:34 UTC (permalink / raw)
  To: Boris Brezillon, Miquel Raynal, Richard Weinberger,
	David Woodhouse, Brian Norris, Marek Vasut, Peter Pan,
	Frieder Schrempf
  Cc: Wei Yongjun, linux-mtd, linux-kernel, kernel-janitors

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>
---
 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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-08 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-04  8:34 [PATCH -next] mtd: spinand: Fix error return code in spinand_init() Wei Yongjun
2018-07-04  8:28 ` Boris Brezillon
2018-07-08 21:49 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).