mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
staging: iio: ad9834: use dev_err_probe() in probe function
Replace open-coded dev_err() + return sequences with dev_err_probe(), which is the preferred pattern for probe error paths as it handles deferred probing correctly and reduces boilerplate. Convert all three remaining instances in ad9834_probe(): - master clock enable failure - device init SPI sync failure The avdd regulator path already used dev_err_probe(). Signed-off-by: Angus Gardner <angusg778@gmail.com> Reviewed-by: Maxwell Doose <m32285159@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
19f2c27251
commit
8b8e850ead
|
|
@ -397,10 +397,9 @@ static int ad9834_probe(struct spi_device *spi)
|
|||
st = iio_priv(indio_dev);
|
||||
mutex_init(&st->lock);
|
||||
st->mclk = devm_clk_get_enabled(&spi->dev, NULL);
|
||||
if (IS_ERR(st->mclk)) {
|
||||
dev_err(&spi->dev, "Failed to enable master clock\n");
|
||||
return PTR_ERR(st->mclk);
|
||||
}
|
||||
if (IS_ERR(st->mclk))
|
||||
return dev_err_probe(&spi->dev, PTR_ERR(st->mclk),
|
||||
"Failed to enable master clock\n");
|
||||
|
||||
st->spi = spi;
|
||||
st->devid = spi_get_device_id(spi)->driver_data;
|
||||
|
|
@ -442,10 +441,9 @@ static int ad9834_probe(struct spi_device *spi)
|
|||
|
||||
st->data = cpu_to_be16(AD9834_REG_CMD | st->control);
|
||||
ret = spi_sync(st->spi, &st->msg);
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "device init failed\n");
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(&spi->dev, ret,
|
||||
"device init failed\n");
|
||||
|
||||
ret = ad9834_write_frequency(st, AD9834_REG_FREQ0, 1000000);
|
||||
if (ret)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user