Re: hello, please help me check this potential bug, thanks.

From
Lars-Peter Clausen <lars@metafoo.de>
Date
2013-12-30 13:42:48
Added linux-input to Cc

On 12/30/2013 08:05 AM, Huqiu Liu wrote:
Dear Lars-Peter Clausen,
I'm very sorry to trouble you. Recently I checked lots of drivers and found the
following potential bug:
1) In the file _/drivers\input\misc\pwm-beeper.c/_, the function
*input_allocate_device * is called by the function *pwm_beeper_probe*. While the
function *pwm_beeper_remove * does not call the function *input_free_device * to
release the acquired resources when removing the device. Generelly the function
*input_free_device * and *input_allocate_device * should be used in pairs, and
more than *109 * drivers have called the function *input_free_device * to
release the resources which are acquired by the function *input_allocate_device*.
The acqured resources are ignored to be released when removing the device, which
would cause memory leaks and other potential problems. Could you help me to
check or confirm this bug please? Thank you very much. I'm looking forward to
your reply.
I think the code is corect. See the input_allocate_device() documentation:

 * input_allocate_device - allocate memory for new input device
 *
 * Returns prepared struct input_dev or %NULL.
 *
 * NOTE: Use input_free_device() to free devices that have not been
 * registered; input_unregister_device() should be used for already
 * registered devices.

- Lars
Thread (1 message) 1 message, 1 author, last reply 2013-12-30
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help