Commit 25ebcb7d authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 99826790
...@@ -438,12 +438,14 @@ int platform_device_add(struct platform_device *pdev) ...@@ -438,12 +438,14 @@ int platform_device_add(struct platform_device *pdev)
p = &ioport_resource; p = &ioport_resource;
} }
if (p && insert_resource(p, r)) { if (p) {
ret = insert_resource(p, r);
if (ret) {
dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r); dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r);
ret = -EBUSY;
goto failed; goto failed;
} }
} }
}
pr_debug("Registering platform device '%s'. Parent at %s\n", pr_debug("Registering platform device '%s'. Parent at %s\n",
dev_name(&pdev->dev), dev_name(pdev->dev.parent)); dev_name(&pdev->dev), dev_name(pdev->dev.parent));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment