From: David Herrmann Date: Mon, 5 Sep 2011 16:45:28 +0000 (+0200) Subject: HID: wacom: Fix error path of power-supply initialization X-Git-Tag: v3.1-rc6~20^2^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dde58cfcc3b6dd2f160ffd355f76ae526155a4df;p=pandora-kernel.git HID: wacom: Fix error path of power-supply initialization power_supply_unregister() must not be called if power_supply_register() failed. The wdata->psy.dev pointer may point to invalid memory after a failed power_supply_register() and hence wacom_remove() will fail while calling power_supply_unregister(). This changes the wacom_probe function to fail if it cannot register the power_supply devices. If we would want to keep the previous behaviour we had to keep some flag about the power_supply state and check it on wacom_remove, but this seems inappropriate here. Hence, we simply fail, too, if power_supply_register fails. Signed-off-by: David Herrmann Signed-off-by: Jiri Kosina --- Reading git-diff-tree failed