From 25ebcb7dc84db59514b7409ad009d8d67833e091 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Thu, 4 Apr 2019 11:11:58 +0300 Subject: [PATCH] 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 --- drivers/base/platform.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; + } } } -- GitLab