diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-04-04 11:11:58 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-25 22:48:37 +0300 |
commit | 25ebcb7dc84db59514b7409ad009d8d67833e091 (patch) | |
tree | d05f2b913cc791ca745d77603d6685d8b9a8abc0 /drivers/base | |
parent | 998267900cee901c5d1dfa029a6304d00acbc29f (diff) | |
download | linux-25ebcb7dc84db59514b7409ad009d8d67833e091.tar.xz |
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')
-rw-r--r-- | drivers/base/platform.c | 10 |
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; + } } } |