提交 1454e15b 编写于 作者: W Wei Yongjun 提交者: Jonathan Cameron

iio: adc: mxs-lradc: Fix return value check in mxs_lradc_adc_probe()

In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test. Also add NULL test for iores.
Signed-off-by: NWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 948588e2
......@@ -718,9 +718,12 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev)
adc->dev = dev;
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!iores)
return -EINVAL;
adc->base = devm_ioremap(dev, iores->start, resource_size(iores));
if (IS_ERR(adc->base))
return PTR_ERR(adc->base);
if (!adc->base)
return -ENOMEM;
init_completion(&adc->completion);
spin_lock_init(&adc->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册