Re: Platform device matching, & weird strncmp usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2006-01-06 at 16:59 +1100, Benjamin Herrenschmidt wrote:
> Hi !
> 
> In 2.6.15, platform device matching works according to this comment in
> the code, or rather are supposed to:

  .../...

Just in case my analysis is correct, here's an untested fix:

---

Platform device matching doesn't work when an "id" is used.

Signed-off-by: Benjamin Herrenschmidt <[email protected]>

--- linux-work.orig/drivers/base/platform.c	2005-11-24 17:18:43.000000000 +1100
+++ linux-work/drivers/base/platform.c	2006-01-06 16:59:59.000000000 +1100
@@ -447,7 +447,8 @@ static int platform_match(struct device 
 {
 	struct platform_device *pdev = container_of(dev, struct platform_device, dev);
 
-	return (strncmp(pdev->name, drv->name, BUS_ID_SIZE) == 0);
+	return strncmp(pdev->name, drv->name,
+			min(BUS_ID_SIZE, strlen(drv->name))) == 0;
 }
 
 static int platform_suspend(struct device * dev, pm_message_t state)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux