From: Ulf Hansson <ulf.hansson@linaro.org>
To: Wan Jiabing <wanjiabing@vivo.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@microchip.com>,
linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kael_w@yeah.net
Subject: Re: [PATCH] mmc: atmel-mci: simplify if-if to if-else
Date: Wed, 27 Apr 2022 00:43:42 +0200 [thread overview]
Message-ID: <CAPDyKFp38EKC88wGZyYm3agvY9zC2M6-qAgMqmOHne0kkDAhCg@mail.gmail.com> (raw)
In-Reply-To: <YmgKa4xQ+pOd2xfh@myhostname>
On Tue, 26 Apr 2022 at 17:06, Wan Jiabing <wanjiabing@vivo.com> wrote:
>
> On Tue, Apr 26, 2022 at 03:53:09PM +0200, Ulf Hansson wrote:
> > On Sun, 24 Apr 2022 at 11:04, Wan Jiabing <wanjiabing@vivo.com> wrote:
> > >
> > > Use if and else instead of if(A) and if (!A).
> > >
> > > Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> > > ---
> > > drivers/mmc/host/atmel-mci.c | 3 +--
> > > 1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> > > index 807177c953f3..98893ccad4bd 100644
> > > --- a/drivers/mmc/host/atmel-mci.c
> > > +++ b/drivers/mmc/host/atmel-mci.c
> > > @@ -1125,8 +1125,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
> > > chan = host->dma.chan;
> > > if (chan)
> > > host->data_chan = chan;
> > > -
> > > - if (!chan)
> > > + else
> > > return -ENODEV;
> >
> > To make a slightly better improvement of the code, I suggest we add an
> > early bail out point in the atmci_prepare_data_dma() function. Like
> > below:
> >
> > if (!host->dma.chan)
> > return -ENODEV;
> >
> > [...]
> >
> > Kind regards
> > Uffe
>
> OK
>
> How about this new patch?
Please post a new version in plain text, not as an attachment.
Kind regards
Uffe
WARNING: multiple messages have this Message-ID (diff)
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Wan Jiabing <wanjiabing@vivo.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Ludovic Desroches <ludovic.desroches@microchip.com>,
kael_w@yeah.net, Claudiu Beznea <claudiu.beznea@microchip.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] mmc: atmel-mci: simplify if-if to if-else
Date: Wed, 27 Apr 2022 00:43:42 +0200 [thread overview]
Message-ID: <CAPDyKFp38EKC88wGZyYm3agvY9zC2M6-qAgMqmOHne0kkDAhCg@mail.gmail.com> (raw)
In-Reply-To: <YmgKa4xQ+pOd2xfh@myhostname>
On Tue, 26 Apr 2022 at 17:06, Wan Jiabing <wanjiabing@vivo.com> wrote:
>
> On Tue, Apr 26, 2022 at 03:53:09PM +0200, Ulf Hansson wrote:
> > On Sun, 24 Apr 2022 at 11:04, Wan Jiabing <wanjiabing@vivo.com> wrote:
> > >
> > > Use if and else instead of if(A) and if (!A).
> > >
> > > Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> > > ---
> > > drivers/mmc/host/atmel-mci.c | 3 +--
> > > 1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> > > index 807177c953f3..98893ccad4bd 100644
> > > --- a/drivers/mmc/host/atmel-mci.c
> > > +++ b/drivers/mmc/host/atmel-mci.c
> > > @@ -1125,8 +1125,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
> > > chan = host->dma.chan;
> > > if (chan)
> > > host->data_chan = chan;
> > > -
> > > - if (!chan)
> > > + else
> > > return -ENODEV;
> >
> > To make a slightly better improvement of the code, I suggest we add an
> > early bail out point in the atmci_prepare_data_dma() function. Like
> > below:
> >
> > if (!host->dma.chan)
> > return -ENODEV;
> >
> > [...]
> >
> > Kind regards
> > Uffe
>
> OK
>
> How about this new patch?
Please post a new version in plain text, not as an attachment.
Kind regards
Uffe
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-04-26 22:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-24 9:04 [PATCH] mmc: atmel-mci: simplify if-if to if-else Wan Jiabing
2022-04-24 9:04 ` Wan Jiabing
2022-04-26 13:53 ` Ulf Hansson
2022-04-26 13:53 ` Ulf Hansson
2022-04-26 15:06 ` Wan Jiabing
2022-04-26 15:06 ` Wan Jiabing
2022-04-26 22:43 ` Ulf Hansson [this message]
2022-04-26 22:43 ` Ulf Hansson
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=CAPDyKFp38EKC88wGZyYm3agvY9zC2M6-qAgMqmOHne0kkDAhCg@mail.gmail.com \
--to=ulf.hansson@linaro.org \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@microchip.com \
--cc=kael_w@yeah.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=nicolas.ferre@microchip.com \
--cc=wanjiabing@vivo.com \
/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.