summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-04-04 11:11:58 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-25 21:48:37 +0200
commit25ebcb7dc84db59514b7409ad009d8d67833e091 (patch)
treed05f2b913cc791ca745d77603d6685d8b9a8abc0
parent998267900cee901c5d1dfa029a6304d00acbc29f (diff)
downloadlinux-25ebcb7dc84db59514b7409ad009d8d67833e091.tar.bz2
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 <andriy.shevchenko@linux.intel.com> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/base/platform.c10
1 files 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;
+ }
}
}