All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH 1/1] dm: simplify uclass_pre_remove_device
Date: Sun, 19 Mar 2023 09:20:30 +1300	[thread overview]
Message-ID: <CAPnjgZ3Qt_0vc2yZUoCpuOFYhM0J6eS4MVV46c2FMtGhXJ6aTA@mail.gmail.com> (raw)
In-Reply-To: <20230318095549.40625-1-heinrich.schuchardt@canonical.com>

Hi Heinrich,

On Sat, 18 Mar 2023 at 03:56, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Remove a superfluous logical constraint.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  drivers/core/uclass.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)

Where possible I like to keep the happy path clear, so that we always
exit with 0.  I know this results in a little more code, but it does
not affect the compiler output. I think it makes it easier to see when
things pass or fail.

>
> diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
> index 1762a0796d..dce5b46fc7 100644
> --- a/drivers/core/uclass.c
> +++ b/drivers/core/uclass.c
> @@ -789,14 +789,10 @@ int uclass_post_probe_device(struct udevice *dev)
>  int uclass_pre_remove_device(struct udevice *dev)
>  {
>         struct uclass *uc;
> -       int ret;
>
>         uc = dev->uclass;
> -       if (uc->uc_drv->pre_remove) {
> -               ret = uc->uc_drv->pre_remove(dev);
> -               if (ret)
> -                       return ret;
> -       }
> +       if (uc->uc_drv->pre_remove)
> +               return uc->uc_drv->pre_remove(dev);
>
>         return 0;
>  }
> --
> 2.39.2
>

Regards,
Simon

      reply	other threads:[~2023-03-18 20:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-18  9:55 [PATCH 1/1] dm: simplify uclass_pre_remove_device Heinrich Schuchardt
2023-03-18 20:20 ` Simon Glass [this message]

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=CAPnjgZ3Qt_0vc2yZUoCpuOFYhM0J6eS4MVV46c2FMtGhXJ6aTA@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.