drivers: bus: Match against id_table first
Matching against driver's name before looking throught its id_table
can lead to a somewhat strange and unintuitive behaviour where a
device whose driver's name matches one of the lines in id_table (which
is not unheard of in Linux kernel) will be probed against said driver
with 'id_table' field set to NULL which in turn will result in
dev_get_drvdata erroring out with -ENODEV.

This patch changes the behaviour such that device_match() only tries
to match against driver's name only if id_table of that driver is not
present.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent cf0dd11 commit b734bb97a22f1c3e96f10eb235050808f661778b
@Andrey Smirnov Andrey Smirnov authored on 7 Dec 2015
Sascha Hauer committed on 7 Dec 2015
Showing 1 changed file
View
drivers/base/bus.c