From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Ruan Jinjie <ruanjinjie@huawei.com>
Cc: <linux-mtd@lists.infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Kamal Dasu <kamal.dasu@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH -next] mtd: rawnand: brcmnand: Remove unnecessary ternary operators
Date: Fri, 4 Aug 2023 15:44:25 +0200 [thread overview]
Message-ID: <20230804154425.4ee7f918@xps-13> (raw)
In-Reply-To: <20230804075717.3336709-1-ruanjinjie@huawei.com>
Hi Ruan,
ruanjinjie@huawei.com wrote on Fri, 4 Aug 2023 15:57:17 +0800:
> Ther are a little ternary operators, the true or false judgement
> of which is unnecessary in C language semantics.
>
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
> drivers/mtd/nand/raw/brcmnand/brcmnand.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> index 03764b589ec5..dc66590eb4cf 100644
> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> @@ -1666,13 +1666,13 @@ static bool brcmstb_nand_wait_for_completion(struct nand_chip *chip)
> disable_ctrl_irqs(ctrl);
> sts = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY,
> NAND_CTRL_RDY, 0);
> - err = (sts < 0) ? true : false;
> + err = sts < 0;
This function returns a negative errno, please propagate the error
instead upon error.
> } else {
> unsigned long timeo = msecs_to_jiffies(
> NAND_POLL_STATUS_TIMEOUT_MS);
> /* wait for completion interrupt */
> sts = wait_for_completion_timeout(&ctrl->done, timeo);
> - err = (sts <= 0) ? true : false;
> + err = sts <= 0;
The < 0 case does not exist so instead you can return -ETIMEDOUT if
(!sts) and zero otherwise.
> }
>
> return err;
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2023-08-04 13:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 7:57 [PATCH -next] mtd: rawnand: brcmnand: Remove unnecessary ternary operators Ruan Jinjie
2023-08-04 13:44 ` Miquel Raynal [this message]
2023-08-05 3:16 ` Ruan Jinjie
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=20230804154425.4ee7f918@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=computersforpeace@gmail.com \
--cc=kamal.dasu@broadcom.com \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=ruanjinjie@huawei.com \
--cc=vigneshr@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox