mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
Input: elan_i2c - simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20230625162817.100397-6-krzysztof.kozlowski@linaro.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
1e402a15bc
commit
50653e8fad
@ -1221,13 +1221,8 @@ static int elan_probe(struct i2c_client *client)
|
||||
mutex_init(&data->sysfs_mutex);
|
||||
|
||||
data->vcc = devm_regulator_get(dev, "vcc");
|
||||
if (IS_ERR(data->vcc)) {
|
||||
error = PTR_ERR(data->vcc);
|
||||
if (error != -EPROBE_DEFER)
|
||||
dev_err(dev, "Failed to get 'vcc' regulator: %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
if (IS_ERR(data->vcc))
|
||||
return dev_err_probe(dev, PTR_ERR(data->vcc), "Failed to get 'vcc' regulator\n");
|
||||
|
||||
error = regulator_enable(data->vcc);
|
||||
if (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user