lkml.org 
[lkml]   [2013]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] gpio: Fix crash in gpiod_set_debounce()
On 09/03/2013 04:39 AM, Thierry Reding wrote:
> Return an error if neither the ->set() nor the ->set_debounce() function
> is implemented by the chip. Furthermore move locking further down so the
> lock doesn't have to be unlocked on error. This is safe to do because at
> this point the lock doesn't protect anything.

> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c

> chip = desc->chip;
> if (!chip->set || !chip->set_debounce) {
> pr_warn("%s: missing set() or set_debounce() operations\n",
> __func__);
> + return -EIO;
> }

BTW, I'm not sure that error-path should pr_warn(). For example, if this
error-patch is taken due to a call from
gpio_keys.c:gpio_keys_setup_key(), then a timer will be used for
debounce instead, which is all perfectly valid, and probably not
something that should be spewed to the kernel log.


\
 
 \ /
  Last update: 2013-09-03 22:41    [W:0.062 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site