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

mfd: hi655x: Fix return value check in hi655x_pmic_probe()

In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR(). Also remove unneeded error handling of
platform_get_resource().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Wei Yongjun and committed by
Lee Jones
7e28abda 4dc03d0a

+2 -5
+2 -5
drivers/mfd/hi655x-pmic.c
··· 105 105 pmic->dev = dev; 106 106 107 107 pmic->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 108 - if (!pmic->res) 109 - return -ENOENT; 110 - 111 108 base = devm_ioremap_resource(dev, pmic->res); 112 - if (!base) 113 - return -ENOMEM; 109 + if (IS_ERR(base)) 110 + return PTR_ERR(base); 114 111 115 112 pmic->regmap = devm_regmap_init_mmio_clk(dev, NULL, base, 116 113 &hi655x_regmap_config);