All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH 1/2] x86: queensbay: Optimize disable_igd() a little
Date: Mon, 2 Aug 2021 11:14:42 +0800	[thread overview]
Message-ID: <CAEUhbmXGFcJhPn1NMY2-HRiKuFExUmhVzJmV8s7=1sP8sU9Ojg@mail.gmail.com> (raw)
In-Reply-To: <CAPnjgZ3sec1uCTDBa5L+jU3PENG9is1gsCvB2+wGvr+O5KxSJw@mail.gmail.com>

Hi Simon,

On Mon, Aug 2, 2021 at 3:19 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Bin,
>
> On Sat, 31 Jul 2021 at 07:17, Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Initialize igd and sdvo to NULL so that we don't need to test the
> > return value of dm_pci_bus_find_bdf() later.
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
> >
> >  arch/x86/cpu/queensbay/tnc.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/x86/cpu/queensbay/tnc.c b/arch/x86/cpu/queensbay/tnc.c
> > index 782ed863fe..e38c0198e4 100644
> > --- a/arch/x86/cpu/queensbay/tnc.c
> > +++ b/arch/x86/cpu/queensbay/tnc.c
> > @@ -18,18 +18,15 @@
> >
> >  static int __maybe_unused disable_igd(void)
> >  {
> > -       struct udevice *igd, *sdvo;
> > +       struct udevice *igd = NULL;
> > +       struct udevice *sdvo = NULL;
> >         int ret;
> >
> >         ret = dm_pci_bus_find_bdf(TNC_IGD, &igd);
> > -       if (ret)
> > -               return ret;
> >         if (!igd)
> >                 return 0;
>
> This is backwards. If ret returns 0 then we know igd is non-NULL. So
> check the return value. That is what it is for. You can drop the check
> of igd. Same below.
>

Ah, yes. I remembered why the original codes were written like this.
Actually the codes tried to be compatible that if the device is
already disabled it should not return error. I will reword the commit
message and add some comments here.

Regards,
Bin

      reply	other threads:[~2021-08-02  3:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-31 13:16 [PATCH 1/2] x86: queensbay: Optimize disable_igd() a little Bin Meng
2021-07-31 13:16 ` [PATCH 2/2] x86: crownbay: Use external graphics card by default Bin Meng
2021-08-01 19:19   ` Simon Glass
2021-08-01 19:19 ` [PATCH 1/2] x86: queensbay: Optimize disable_igd() a little Simon Glass
2021-08-02  3:14   ` Bin Meng [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='CAEUhbmXGFcJhPn1NMY2-HRiKuFExUmhVzJmV8s7=1sP8sU9Ojg@mail.gmail.com' \
    --to=bmeng.cn@gmail.com \
    --cc=sjg@chromium.org \
    --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.