mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] driver core: platform: Propagate error from insert_resource()
Date: Wed, 3 Apr 2019 14:29:23 +0300	[thread overview]
Message-ID: <20190403112923.GV9224@smile.fi.intel.com> (raw)
In-Reply-To: <CAJZ5v0hCrpyxJzMOQXthHkqLBaYBH44f_XsHy-YUfxxUU_o41w@mail.gmail.com>

On Tue, Apr 02, 2019 at 06:02:40PM +0200, Rafael J. Wysocki wrote:
> On Tue, Apr 2, 2019 at 5:59 PM 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.

> > -               if (p && insert_resource(p, r)) {
> > +               if (p && (ret = insert_resource(p, r))) {
> 
> I would put the assignment here.
> 
> >                         dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r);
> > -                       ret = -EBUSY;
> >                         goto failed;
> >                 }

Something like this?

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;
+                       }
                }
        }


-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2019-04-03 11:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 15:59 Andy Shevchenko
2019-04-02 16:02 ` Rafael J. Wysocki
2019-04-03 11:29   ` Andy Shevchenko [this message]
2019-04-03 20:54     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190403112923.GV9224@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®