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

i2c: mlxbf: Fix the return check of devm_ioremap and ioremap

devm_ioremap and ioremap may return NULL which cannot be checked
by IS_ERR.

Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Acked-by: Khalil Blaiech <kblaiech@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

authored by

Wang Xiaojun and committed by
Wolfram Sang
2bf95456 c62dac0a

+6 -6
+6 -6
drivers/i2c/busses/i2c-mlxbf.c
··· 1258 1258 return -EFAULT; 1259 1259 1260 1260 gpio_res->io = devm_ioremap(dev, params->start, size); 1261 - if (IS_ERR(gpio_res->io)) { 1261 + if (!gpio_res->io) { 1262 1262 devm_release_mem_region(dev, params->start, size); 1263 - return PTR_ERR(gpio_res->io); 1263 + return -ENOMEM; 1264 1264 } 1265 1265 1266 1266 return 0; ··· 1323 1323 return -EFAULT; 1324 1324 1325 1325 corepll_res->io = devm_ioremap(dev, params->start, size); 1326 - if (IS_ERR(corepll_res->io)) { 1326 + if (!corepll_res->io) { 1327 1327 devm_release_mem_region(dev, params->start, size); 1328 - return PTR_ERR(corepll_res->io); 1328 + return -ENOMEM; 1329 1329 } 1330 1330 1331 1331 return 0; ··· 1717 1717 return -EFAULT; 1718 1718 1719 1719 coalesce_res->io = ioremap(params->start, size); 1720 - if (IS_ERR(coalesce_res->io)) { 1720 + if (!coalesce_res->io) { 1721 1721 release_mem_region(params->start, size); 1722 - return PTR_ERR(coalesce_res->io); 1722 + return -ENOMEM; 1723 1723 } 1724 1724 1725 1725 priv->coalesce = coalesce_res;