lkml.org 
[lkml]   [2009]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] driver core: check bus->match without holding device lock(v2)
Date
tom.leiming@gmail.com writes:

> +static inline int driver_match_device(struct device_driver *drv,
> + struct device *dev)
> +{
> + return drv->bus->match && drv->bus->match(dev, drv);
> +}

This logic is wrong. !(a && !b) <=> !a || b, not a && b

A bus that does not have a match function now never matches, whereas
previously it would always match. This breaks aoa-soundbus.

Andreas.
---
driver core: Fix logic in driver_match_device

A bus that does not have a match function always matches. This fixes
49b420a13ff9 ("driver core: check bus->match without holding device
lock").

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
drivers/base/base.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/base.h b/drivers/base/base.h
index ddc9749..087e911 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -115,7 +115,7 @@ extern int driver_probe_device(struct device_driver *drv, struct device *dev);
static inline int driver_match_device(struct device_driver *drv,
struct device *dev)
{
- return drv->bus->match && drv->bus->match(dev, drv);
+ return !drv->bus->match || drv->bus->match(dev, drv);
}

extern void sysdev_shutdown(void);
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."


\
 
 \ /
  Last update: 2009-04-10 17:35    [W:2.245 / U:0.936 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site