Skip to content

Commit 7cda46c

Browse files
andy-shevdtor
authored andcommitted
Input: gpio_decoder - unify messages with help of dev_err_probe()
Unify error messages that might appear during probe phase by switching to use dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20251113154616.3107676-3-andriy.shevchenko@linux.intel.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent c83504a commit 7cda46c

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

drivers/input/misc/gpio_decoder.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
#include <linux/device.h>
10+
#include <linux/err.h>
1011
#include <linux/gpio/consumer.h>
1112
#include <linux/input.h>
1213
#include <linux/kernel.h>
@@ -73,15 +74,12 @@ static int gpio_decoder_probe(struct platform_device *pdev)
7374
device_property_read_u32(dev, "linux,axis", &decoder->axis);
7475

7576
decoder->input_gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN);
76-
if (IS_ERR(decoder->input_gpios)) {
77-
dev_err(dev, "unable to acquire input gpios\n");
78-
return PTR_ERR(decoder->input_gpios);
79-
}
77+
if (IS_ERR(decoder->input_gpios))
78+
return dev_err_probe(dev, PTR_ERR(decoder->input_gpios),
79+
"unable to acquire input gpios\n");
8080

81-
if (decoder->input_gpios->ndescs < 2) {
82-
dev_err(dev, "not enough gpios found\n");
83-
return -EINVAL;
84-
}
81+
if (decoder->input_gpios->ndescs < 2)
82+
return dev_err_probe(dev, -EINVAL, "not enough gpios found\n");
8583

8684
if (device_property_read_u32(dev, "decoder-max-value", &max))
8785
max = (1U << decoder->input_gpios->ndescs) - 1;
@@ -97,16 +95,12 @@ static int gpio_decoder_probe(struct platform_device *pdev)
9795
input_set_abs_params(input, decoder->axis, 0, max, 0, 0);
9896

9997
err = input_setup_polling(input, gpio_decoder_poll_gpios);
100-
if (err) {
101-
dev_err(dev, "failed to set up polling\n");
102-
return err;
103-
}
98+
if (err)
99+
return dev_err_probe(dev, err, "failed to set up polling\n");
104100

105101
err = input_register_device(input);
106-
if (err) {
107-
dev_err(dev, "failed to register input device\n");
108-
return err;
109-
}
102+
if (err)
103+
return dev_err_probe(dev, err, "failed to register input device\n");
110104

111105
return 0;
112106
}

0 commit comments

Comments
 (0)