iio: Remove error prints for devm_add_action_or_reset()
When `devm_add_action_or_reset()` fails, it is due to a failed memory allocation and will thus return `-ENOMEM`. `dev_err_probe()` doesn't do anything when error is `-ENOMEM`. Therefore, remove the useless call to `dev_err_probe()` when `devm_add_action_or_reset()` fails, and just return the value instead. Signed-off-by: Waqar Hameed <waqar.hameed@axis.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://patch.msgid.link/pndectqm7te.a.out@axis.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>pull/1354/merge
parent
b515c701bb
commit
65e8202f03
|
|
@ -1195,7 +1195,7 @@ static int msa311_probe(struct i2c_client *i2c)
|
|||
*/
|
||||
err = devm_add_action_or_reset(dev, msa311_powerdown, msa311);
|
||||
if (err)
|
||||
return dev_err_probe(dev, err, "can't add powerdown action\n");
|
||||
return err;
|
||||
|
||||
err = pm_runtime_set_active(dev);
|
||||
if (err)
|
||||
|
|
|
|||
|
|
@ -2035,8 +2035,7 @@ static int ad4130_probe(struct spi_device *spi)
|
|||
|
||||
ret = devm_add_action_or_reset(dev, ad4130_disable_regulators, st);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"Failed to add regulators disable action\n");
|
||||
return ret;
|
||||
|
||||
ret = ad4130_soft_reset(st);
|
||||
if (ret)
|
||||
|
|
|
|||
|
|
@ -1300,7 +1300,7 @@ static int ad7124_probe(struct spi_device *spi)
|
|||
ret = devm_add_action_or_reset(&spi->dev, ad7124_reg_disable,
|
||||
st->vref[i]);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Failed to register disable handler for regulator #%d\n", i);
|
||||
return ret;
|
||||
}
|
||||
|
||||
st->mclk = devm_clk_get_enabled(&spi->dev, "mclk");
|
||||
|
|
|
|||
|
|
@ -1731,8 +1731,7 @@ static int ad7173_fw_parse_device_config(struct iio_dev *indio_dev)
|
|||
|
||||
ret = devm_add_action_or_reset(dev, ad7173_disable_regulators, st);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"Failed to add regulators disable action\n");
|
||||
return ret;
|
||||
|
||||
ret = device_property_match_property_string(dev, "clock-names",
|
||||
ad7173_clk_sel,
|
||||
|
|
|
|||
|
|
@ -297,8 +297,7 @@ static int mt6577_auxadc_probe(struct platform_device *pdev)
|
|||
|
||||
ret = devm_add_action_or_reset(&pdev->dev, mt6577_power_off, adc_dev);
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret,
|
||||
"Failed to add action to managed power off\n");
|
||||
return ret;
|
||||
|
||||
ret = devm_iio_device_register(&pdev->dev, indio_dev);
|
||||
if (ret < 0)
|
||||
|
|
|
|||
|
|
@ -1279,8 +1279,7 @@ static int pac1921_probe(struct i2c_client *client)
|
|||
ret = devm_add_action_or_reset(dev, pac1921_regulator_disable,
|
||||
priv->vdd);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"Cannot add action for vdd regulator disposal\n");
|
||||
return ret;
|
||||
|
||||
msleep(PAC1921_POWERUP_TIME_MS);
|
||||
|
||||
|
|
|
|||
|
|
@ -527,8 +527,7 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
|
|||
ret = devm_add_action_or_reset(&pdev->dev,
|
||||
rockchip_saradc_regulator_disable, info);
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret,
|
||||
"failed to register devm action\n");
|
||||
return ret;
|
||||
|
||||
ret = regulator_get_voltage(info->vref);
|
||||
if (ret < 0)
|
||||
|
|
|
|||
|
|
@ -778,8 +778,7 @@ static int ads1119_probe(struct i2c_client *client)
|
|||
|
||||
ret = devm_add_action_or_reset(dev, ads1119_powerdown, st);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"Failed to add powerdown action\n");
|
||||
return ret;
|
||||
|
||||
return devm_iio_device_register(dev, indio_dev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -399,8 +399,7 @@ static int ads7924_probe(struct i2c_client *client)
|
|||
|
||||
ret = devm_add_action_or_reset(dev, ads7924_reg_disable, data->vref_reg);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"failed to add regulator disable action\n");
|
||||
return ret;
|
||||
|
||||
ret = ads7924_reset(indio_dev);
|
||||
if (ret < 0)
|
||||
|
|
@ -414,8 +413,7 @@ static int ads7924_probe(struct i2c_client *client)
|
|||
|
||||
ret = devm_add_action_or_reset(dev, ads7924_set_idle_mode, data);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"failed to add idle mode action\n");
|
||||
return ret;
|
||||
|
||||
/* Use minimum signal acquire time. */
|
||||
ret = regmap_update_bits(data->regmap, ADS7924_ACQCONFIG_REG,
|
||||
|
|
|
|||
|
|
@ -673,8 +673,7 @@ static int adf4350_probe(struct spi_device *spi)
|
|||
|
||||
ret = devm_add_action_or_reset(&spi->dev, adf4350_power_down, indio_dev);
|
||||
if (ret)
|
||||
return dev_err_probe(&spi->dev, ret,
|
||||
"Failed to add action to managed power down\n");
|
||||
return ret;
|
||||
|
||||
return devm_iio_device_register(&spi->dev, indio_dev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ static int al3000a_init(struct al3000a_data *data)
|
|||
|
||||
ret = devm_add_action_or_reset(dev, al3000a_set_pwr_off, data);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to add action\n");
|
||||
return ret;
|
||||
|
||||
ret = regmap_write(data->regmap, AL3000A_REG_SYSTEM, AL3000A_CONFIG_RESET);
|
||||
if (ret)
|
||||
|
|
|
|||
|
|
@ -1309,7 +1309,7 @@ static int apds9306_probe(struct i2c_client *client)
|
|||
|
||||
ret = devm_add_action_or_reset(dev, apds9306_powerdown, data);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to add action or reset\n");
|
||||
return ret;
|
||||
|
||||
ret = devm_iio_device_register(dev, indio_dev);
|
||||
if (ret)
|
||||
|
|
|
|||
|
|
@ -814,8 +814,7 @@ static int bh1745_init(struct bh1745_data *data)
|
|||
|
||||
ret = devm_add_action_or_reset(dev, bh1745_power_off, data);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"Failed to add action or reset\n");
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -428,8 +428,7 @@ static int opt4001_probe(struct i2c_client *client)
|
|||
opt4001_chip_off_action,
|
||||
chip);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(&client->dev, ret,
|
||||
"Failed to setup power off action\n");
|
||||
return ret;
|
||||
|
||||
return devm_iio_device_register(&client->dev, indio_dev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1299,8 +1299,7 @@ static int opt4060_probe(struct i2c_client *client)
|
|||
|
||||
ret = devm_add_action_or_reset(dev, opt4060_chip_off_action, chip);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(dev, ret,
|
||||
"Failed to setup power off action\n");
|
||||
return ret;
|
||||
|
||||
ret = opt4060_setup_buffer(chip, indio_dev);
|
||||
if (ret)
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ static int als31300_probe(struct i2c_client *i2c)
|
|||
|
||||
ret = devm_add_action_or_reset(dev, als31300_power_down, data);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to add powerdown action\n");
|
||||
return ret;
|
||||
|
||||
indio_dev->info = &als31300_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ static int tmag5273_probe(struct i2c_client *i2c)
|
|||
*/
|
||||
ret = devm_add_action_or_reset(dev, tmag5273_power_down, data);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to add powerdown action\n");
|
||||
return ret;
|
||||
|
||||
ret = pm_runtime_set_active(dev);
|
||||
if (ret < 0)
|
||||
|
|
|
|||
|
|
@ -351,8 +351,7 @@ static int vl53l0x_probe(struct i2c_client *client)
|
|||
|
||||
error = devm_add_action_or_reset(&client->dev, vl53l0x_power_off, data);
|
||||
if (error)
|
||||
return dev_err_probe(&client->dev, error,
|
||||
"Failed to install poweroff action\n");
|
||||
return ret;
|
||||
|
||||
indio_dev->name = "vl53l0x";
|
||||
indio_dev->info = &vl53l0x_info;
|
||||
|
|
|
|||
|
|
@ -977,8 +977,7 @@ static int mlx90635_probe(struct i2c_client *client)
|
|||
ret = devm_add_action_or_reset(&client->dev, mlx90635_disable_regulator,
|
||||
mlx90635);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(&client->dev, ret,
|
||||
"failed to setup regulator cleanup action\n");
|
||||
return ret;
|
||||
|
||||
ret = mlx90635_wakeup(mlx90635);
|
||||
if (ret < 0)
|
||||
|
|
@ -986,8 +985,7 @@ static int mlx90635_probe(struct i2c_client *client)
|
|||
|
||||
ret = devm_add_action_or_reset(&client->dev, mlx90635_sleep, mlx90635);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(&client->dev, ret,
|
||||
"failed to setup low power cleanup\n");
|
||||
return ret;
|
||||
|
||||
ret = regmap_read(mlx90635->regmap_ee, MLX90635_EE_VERSION, &dsp_version);
|
||||
if (ret < 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue