lkml.org 
[lkml]   [2019]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] driver core: platform: Propagate error from insert_resource()
On Thu, Apr 4, 2019 at 10:12 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> 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>

> ---
> - move an assignment to the separate line inside first branch (Rafael)
>
> 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 dab0a5abc391..9cf9e2af9efd 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;
> + }
> }
> }
>
> --
> 2.20.1
>

\
 
 \ /
  Last update: 2019-04-04 10:26    [W:0.035 / U:27.544 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site