lkml.org 
[lkml]   [2013]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] BUG: pinmux: forbid mux_usecount to be set at UINT_MAX
2013/3/20 Stephen Warren <swarren@wwwdotorg.org>:
> On 03/20/2013 05:31 AM, Richard Genoud wrote:
>> If pin_free is called on a pin already freed, mux_usecount is set to
>> UINT_MAX which is really a bad idea.
>> This will silently ignore a double call to pin_free
>
> Shouldn't we WARN_ON(this case)?
yes indeed, it may be better to issue a big warning because AFAIK
that's not normal.

>
>> diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
>
>> if (!gpio_range) {
>> - desc->mux_usecount--;
>> - if (desc->mux_usecount)
>> + if (1 == desc->mux_usecount)
>> + desc->mux_usecount = 0;
>> + else
>> return NULL;
>
> What if desc-mux_usecount was 2; this patch prevents the use-count from
> being decremented to 1 in this case. Shouldn't this be:
>
> if (!gpio_range) {
> + if (WARN_ON(!desc->mux_usecount))
> + return NULL;
> desc->mux_usecount--;
>
Well, I'm not very familiar with this code, but can mux_usecount be
higher than 1 ?


\
 
 \ /
  Last update: 2013-03-20 18:43    [W:0.041 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site