Re: i2c-HID: Delete unnecessary checks before the function call "gpiod_put"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>> The gpiod_put() function performs also input parameter validation
>>> by forwarding its single input pointer to the gpiod_free() function.
>>> Thus the test around the calls is not needed.
>>>
>>> This issue was detected by using the Coccinelle software.
>>>
>>> Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
>>
>> As Dan correctly pointed out, this is not as straightforward as it might
>> seem on a firsr sight, because there is a WARN_ON() that might start
>> triggering in case of !ihid->desc.
>>
>> Adding Benjamin. I am not applying this without his Ack.
>>
> 
> I think the gpiod case is the exception rather than the common rule
> (most i2c-hid device we saw until recently were using irqs, not
> gpios). So if I understand correctly, removing the check on ihid->desc
> would raise a warning for most devices. This is IMO not a good thing,
> so I would say NACK.
> 
> Mika might have a different opinion though.

The proposed update candidates are contained in the source
file "drivers/hid/i2c-hid/i2c-hid.c" from Linux next-20150708.

* i2c_hid_remove() function:
  Can it be tolerated here that the pointer "ihid->desc" might be eventually null?

* i2c_hid_probe() function:
  Is this implementation structured in such a way that a pointer for valid data
  will be usually passed for "ihid->desc" if the statements after the jump
  label "err" will be reached?

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux