Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mtd: devices: docg3: check the return value of devm_ioremap() in the probe

The function devm_ioremap() in docg3_probe() can fail, so
its return value should be checked.

Fixes: 82402aeb8c81e ("mtd: docg3: Use devm_*() functions")
Reported-by: Hacash Robot <hacashRobot@santino.com>
Signed-off-by: William Dean <williamsukatube@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220722091644.2937953-1-williamsukatube@163.com

authored by

William Dean and committed by
Miquel Raynal
26e78443 002181f5

+6 -1
+6 -1
drivers/mtd/devices/docg3.c
··· 1974 1974 dev_err(dev, "No I/O memory resource defined\n"); 1975 1975 return ret; 1976 1976 } 1977 - base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); 1978 1977 1979 1978 ret = -ENOMEM; 1979 + base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); 1980 + if (!base) { 1981 + dev_err(dev, "devm_ioremap dev failed\n"); 1982 + return ret; 1983 + } 1984 + 1980 1985 cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade), 1981 1986 GFP_KERNEL); 1982 1987 if (!cascade)