From: Andy Shevchenko Date: Thu, 4 Apr 2019 08:11:58 +0000 (+0300) Subject: driver core: platform: Propagate error from insert_resource() X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=25ebcb7dc84db59514b7409ad009d8d67833e091;p=openwrt%2Fstaging%2Fblogic.git driver core: platform: Propagate error from insert_resource() Since insert_resource() might return an error we don't need to shadow its error code and would safely propagate to the user. Signed-off-by: Andy Shevchenko Reviewed-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 09c00d91094c..4d1729853d1a 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -438,10 +438,12 @@ int platform_device_add(struct platform_device *pdev) p = &ioport_resource; } - if (p && insert_resource(p, r)) { - dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r); - ret = -EBUSY; - goto failed; + if (p) { + ret = insert_resource(p, r); + if (ret) { + dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r); + goto failed; + } } }