diff mbox series

input: adp5589-keys: Add err log

Message ID 20210220172040.1559-1-jzp0409@163.com (mailing list archive)
State Rejected
Headers show
Series input: adp5589-keys: Add err log | expand

Commit Message

jzp0409 Feb. 20, 2021, 5:20 p.m. UTC
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(-)

Comments

Dmitry Torokhov Feb. 20, 2021, 10:21 p.m. UTC | #1
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 mbox series

Patch

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(