From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Colin Ian King <colin.i.king@gmail.com>,
Richard Weinberger <richard@nod.at>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
<linux-mtd@lists.infradead.org>
Cc: <kernel-janitors@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mtd: ubi: remove redundant check on bytes_left at end of function
Date: Fri, 8 Nov 2024 09:41:44 +0800 [thread overview]
Message-ID: <56b13d09-91ce-6a4b-c6cb-449b478e3335@huawei.com> (raw)
In-Reply-To: <20241107152357.63387-1-colin.i.king@gmail.com>
在 2024/11/7 23:23, Colin Ian King 写道:
> In function ubi_nvmem_reg_read the while-loop can only be exiting
> of bytes_left is zero or an error has occurred. There is an exit
> return path if an error occurs, so the bytes_left can only be
> zero after that point. Hence the check for a non-zero bytes_left
> at the end of the function is redundant and can be removed. Remove
> the check and just return 0.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> drivers/mtd/ubi/nvmem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Make sense.
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> diff --git a/drivers/mtd/ubi/nvmem.c b/drivers/mtd/ubi/nvmem.c
> index a94a1a9aaec1..34f8c1d3cdee 100644
> --- a/drivers/mtd/ubi/nvmem.c
> +++ b/drivers/mtd/ubi/nvmem.c
> @@ -55,7 +55,7 @@ static int ubi_nvmem_reg_read(void *priv, unsigned int from,
> if (err)
> return err;
>
> - return bytes_left == 0 ? 0 : -EIO;
> + return 0;
> }
>
> static int ubi_nvmem_add(struct ubi_volume_info *vi)
>
prev parent reply other threads:[~2024-11-08 1:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 15:23 Colin Ian King
2024-11-08 1:41 ` Zhihao Cheng [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=56b13d09-91ce-6a4b-c6cb-449b478e3335@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=colin.i.king@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--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
all inboxes | Powered by JetHome®