Commit f33113b5 authored by YueHaibing's avatar YueHaibing Committed by Miquel Raynal

mtd: sharpslpart: Fix unsigned comparison to zero

The unsigned variable log_num is being assigned a return value
from the call to sharpsl_nand_get_logical_num that can return
-EINVAL.

Detected using Coccinelle:
./drivers/mtd/parsers/sharpslpart.c:207:6-13: WARNING: Unsigned expression compared with zero: log_num > 0

Fixes: 8a4580e4 ("mtd: sharpslpart: Add sharpslpart partition parser")
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 05a5a6e5
...@@ -165,10 +165,10 @@ static int sharpsl_nand_get_logical_num(u8 *oob) ...@@ -165,10 +165,10 @@ static int sharpsl_nand_get_logical_num(u8 *oob)
static int sharpsl_nand_init_ftl(struct mtd_info *mtd, struct sharpsl_ftl *ftl) static int sharpsl_nand_init_ftl(struct mtd_info *mtd, struct sharpsl_ftl *ftl)
{ {
unsigned int block_num, log_num, phymax; unsigned int block_num, phymax;
int i, ret, log_num;
loff_t block_adr; loff_t block_adr;
u8 *oob; u8 *oob;
int i, ret;
oob = kzalloc(mtd->oobsize, GFP_KERNEL); oob = kzalloc(mtd->oobsize, GFP_KERNEL);
if (!oob) if (!oob)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment