summaryrefslogtreecommitdiffstats
path: root/drivers/base/platform.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-04-04 10:11:58 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-25 21:48:37 +0200
commit25ebcb7dc84db59514b7409ad009d8d67833e091 (patch)
treed05f2b913cc791ca745d77603d6685d8b9a8abc0 /drivers/base/platform.c
parentkernfs: fix barrier usage in __kernfs_new_node() (diff)
downloadlinux-25ebcb7dc84db59514b7409ad009d8d67833e091.tar.xz
linux-25ebcb7dc84db59514b7409ad009d8d67833e091.zip
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>
Diffstat (limited to 'drivers/base/platform.c')
-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;
+ }
}
}