From 224683093f4983ffc387d974b2f3309d2720e366 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Thu, 22 Jul 2010 10:36:28 -0600 Subject: [PATCH] --- yaml --- r: 204932 b: refs/heads/master c: c1b6d380b781b5238989a4bfba02450057670804 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/of/platform.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 2c97cd786213..f425239763f6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 295960429675e17ec658320ebb24385727032bed +refs/heads/master: c1b6d380b781b5238989a4bfba02450057670804 diff --git a/trunk/drivers/of/platform.c b/trunk/drivers/of/platform.c index 712dfd866df0..f3f1ec81ef48 100644 --- a/trunk/drivers/of/platform.c +++ b/trunk/drivers/of/platform.c @@ -30,8 +30,13 @@ static int platform_driver_probe_shim(struct platform_device *pdev) pdrv = container_of(pdev->dev.driver, struct platform_driver, driver); ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver); + + /* There is an unlikely chance that an of_platform driver might match + * on a non-OF platform device. If so, then of_match_device() will + * come up empty. Return -EINVAL in this case so other drivers get + * the chance to bind. */ match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); - return ofpdrv->probe(pdev, match); + return match ? ofpdrv->probe(pdev, match) : -EINVAL; } static void platform_driver_shutdown_shim(struct platform_device *pdev)