Messages in this thread | | | Date | Thu, 7 Feb 2008 17:07:23 -0500 | From | Dmitry Torokhov <> | Subject | Re: [PATCH 1/6] Core driver for WM97xx touchscreens |
| |
Hi Mark,
On Sat, Jan 26, 2008 at 05:28:31PM +0000, Mark Brown wrote: > + > + /* register our battery device */ > + wm->battery_dev = platform_device_alloc("wm97xx-battery", 0); > + if (!wm->battery_dev) > + goto batt_err; ... > + batt_err: > + input_unregister_device(wm->input_dev); > + kfree(wm); > + return ret; > +}
The probe error handling is not quite correct. When we reach the fragment above ret variable is 0 so if platfrom_device_alloc() fails we will return 0 and the device will be considered bound but in half-dead state. Please make sure that proper error is returned in all cases. Also please do not mix out of line and in-line error unwinding (input_free_device() should be called in the error path and if you are concerned about double-free after input_unregister_device() just set wm->input_dev to NULL there).
Thanks.
-- Dmitry
| |