Message ID | 20210220172040.1559-1-jzp0409@163.com |
---|---|
State | New |
Headers | show |
Series | input: adp5589-keys: Add err log | expand |
Hi, On Sun, Feb 21, 2021 at 01:20:40AM +0800, jzp0409 wrote: > From: jiangzhipeng <jiangzhipeng@yulong.com> > > When devm_gpiochip_add_data() failed ,print err log > > Signed-off-by: jiangzhipeng <jiangzhipeng@yulong.com> > --- > drivers/input/keyboard/adp5589-keys.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c > index 654e047..e99c0bd 100644 > --- a/drivers/input/keyboard/adp5589-keys.c > +++ b/drivers/input/keyboard/adp5589-keys.c > @@ -526,8 +526,10 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) > mutex_init(&kpad->gpio_lock); > > error = devm_gpiochip_add_data(dev, &kpad->gc, kpad); > - if (error) > + if (error) { > + dev_err(dev, "devm_gpiochip_add_data() failed, err: %d\n", error); > return error; > + } I believe devm_gpiochip_add_data() already provides enough diagnostic when it fails, there is no need for additional diagnostic here. > > for (i = 0; i <= kpad->var->bank(kpad->var->maxgpio); i++) { > kpad->dat_out[i] = adp5589_read(kpad->client, kpad->var->reg( > -- > 1.9.1 > > Thanks.
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 654e047..e99c0bd 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -526,8 +526,10 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) mutex_init(&kpad->gpio_lock); error = devm_gpiochip_add_data(dev, &kpad->gc, kpad); - if (error) + if (error) { + dev_err(dev, "devm_gpiochip_add_data() failed, err: %d\n", error); return error; + } for (i = 0; i <= kpad->var->bank(kpad->var->maxgpio); i++) { kpad->dat_out[i] = adp5589_read(kpad->client, kpad->var->reg(