diff options
author | Yang Li <yang.lee@linux.alibaba.com> | 2021-04-26 11:32:23 +0200 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2021-05-10 12:47:40 +0200 |
commit | 9c5b19c2eea8cb8d5784dedce8cac07e9a20198e (patch) | |
tree | 82981f597794d65094715539a41932807f9772d5 /drivers/mtd/nftlmount.c | |
parent | mtd: mtd_oobtest: Remove redundant assignment to err (diff) | |
download | linux-9c5b19c2eea8cb8d5784dedce8cac07e9a20198e.tar.xz linux-9c5b19c2eea8cb8d5784dedce8cac07e9a20198e.zip |
mtd: *nftl: return -ENOMEM when kmalloc failed
The driver is using -1 instead of the -ENOMEM defined macro to
specify that a buffer allocation failed. Using the correct error
code is more intuitive
Smatch tool warning:
drivers/mtd/inftlmount.c:333 check_free_sectors() warn: returning -1
instead of -ENOMEM is sloppy
drivers/mtd/nftlmount.c:272 check_free_sectors() warn: returning -1
instead of -ENOMEM is sloppy
No functional change, just more standardized.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
[<miquel.raynal@bootlin.com>: Fixed the title]
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/1619429543-52234-1-git-send-email-yang.lee@linux.alibaba.com
Diffstat (limited to 'drivers/mtd/nftlmount.c')
-rw-r--r-- | drivers/mtd/nftlmount.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nftlmount.c b/drivers/mtd/nftlmount.c index 444a77bb7692..fd331bc15871 100644 --- a/drivers/mtd/nftlmount.c +++ b/drivers/mtd/nftlmount.c @@ -269,7 +269,7 @@ static int check_free_sectors(struct NFTLrecord *nftl, unsigned int address, int buf = kmalloc(SECTORSIZE + mtd->oobsize, GFP_KERNEL); if (!buf) - return -1; + return -ENOMEM; ret = -1; for (i = 0; i < len; i += SECTORSIZE) { |