From: Thomas Gleixner Date: Thu, 10 Dec 2009 19:32:49 +0000 (+0000) Subject: Driver-core: Fix bogus 0 error return in device_add() X-Git-Tag: v2.6.33-rc2~12^2~3 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6309e7568d4b9d62298a887b10de42df11cb8c1;p=pandora-kernel.git Driver-core: Fix bogus 0 error return in device_add() If device_add() is called with a device which does not have dev->p set up, then device_private_init() is called. If that succeeds, then the error variable is set to 0. Now if the dev_name(dev) check further down fails, then device_add() correctly terminates, but returns 0. That of course lets the driver progress. If later another driver uses this half set up device as parent then device_add() of the child device explodes and renders sysfs completely unusable. Set the error to -EINVAL if dev_name() check fails. Signed-off-by: Thomas Gleixner Cc: Kay Sievers Cc: "Hans J. Koch" Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed