提交 3f5def65 编写于 作者: C Crt Mori 提交者: Jonathan Cameron

iio: ms65611_core: Fixes dereferencing regulator pointer

Change in handling of the regulator description means that static
checkers correctly assume we could be using dereferenced pointer to the
regulator. In reality we will never get the -ENODEV error, as current
behavior flow does not predict it, because:
If the device tree or board file does not define suitable regulators for
the component, it will be substituted by a dummy regulator, or, if
regulators are disabled altogether, by stubs.
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Suggested-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NCrt Mori <cmo@melexis.com>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 d5d4602e
...@@ -392,17 +392,14 @@ static int ms5611_init(struct iio_dev *indio_dev) ...@@ -392,17 +392,14 @@ static int ms5611_init(struct iio_dev *indio_dev)
/* Enable attached regulator if any. */ /* Enable attached regulator if any. */
st->vdd = devm_regulator_get(indio_dev->dev.parent, "vdd"); st->vdd = devm_regulator_get(indio_dev->dev.parent, "vdd");
if (!IS_ERR(st->vdd)) { if (IS_ERR(st->vdd))
ret = regulator_enable(st->vdd); return PTR_ERR(st->vdd);
if (ret) {
dev_err(indio_dev->dev.parent, ret = regulator_enable(st->vdd);
"failed to enable Vdd supply: %d\n", ret); if (ret) {
return ret; dev_err(indio_dev->dev.parent,
} "failed to enable Vdd supply: %d\n", ret);
} else { return ret;
ret = PTR_ERR(st->vdd);
if (ret != -ENODEV)
return ret;
} }
ret = ms5611_reset(indio_dev); ret = ms5611_reset(indio_dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册