提交 6be72b90 编写于 作者: A Angelo Compagnucci 提交者: Jonathan Cameron

iio: adc: mcp3422: Checking for error on probe

Some part of the configuration are not touched after the probe
and if something goes wrong on writing the initial one,
the chip will misbehave.
Adding an error checking ensures that the inital configuration will
be written correctly. Moreover ensures that a sensible configuration
will be saved in driver data and used subsequently as intended.
Signed-off-by: NAngelo Compagnucci <angelo.compagnucci@gmail.com>
Reported-by: NMaarten Brock <m.brock@vanmierlo.com>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 e3169994
......@@ -382,7 +382,9 @@ static int mcp3422_probe(struct i2c_client *client,
| MCP3422_CHANNEL_VALUE(0)
| MCP3422_PGA_VALUE(MCP3422_PGA_1)
| MCP3422_SAMPLE_RATE_VALUE(MCP3422_SRATE_240));
mcp3422_update_config(adc, config);
err = mcp3422_update_config(adc, config);
if (err < 0)
return err;
err = devm_iio_device_register(&client->dev, indio_dev);
if (err < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册