From: Alexander Dahl <ada@thorsis.com>
To: Marcus Folkesson <marcus.folkesson@gmail.com>
Cc: u-boot@lists.denx.de, Alexander Dahl <ada@thorsis.com>,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Eugen Hristev <eugen.hristev@collabora.com>,
Igor Prusov <ivprusov@salutedevices.com>,
Michael Trimarchi <michael@amarulasolutions.com>,
Sean Anderson <seanga2@gmail.com>, Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH] mtd: nand: raw: atmel: remove unnecessary return value
Date: Fri, 9 Aug 2024 14:25:04 +0200 [thread overview]
Message-ID: <20240809-challenge-causation-20cf58794b33@thorsis.com> (raw)
In-Reply-To: <20240809121556.3215132-1-marcus.folkesson@gmail.com>
Hello Marcus,
Am Fri, Aug 09, 2024 at 02:15:43PM +0200 schrieb Marcus Folkesson:
> The condition 'ret' is always true as it is never set to other than
> -EIO.
Technically, you're right.
I quickly compared with the same driver in Linux. That has some
additional lines for DMA transfers which probably got removed when
porting the driver.
Does the code before your patch throw compiler warnings? If not, I
would keep it as is. The compiler will probably optimize it away
anyway, and it would make future ports from Linux easier.
Greets
Alex
>
> Remove 'ret' and the condition for copy.
>
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> ---
>
> drivers/mtd/nand/raw/atmel/nand-controller.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
> index ee4ec6da58..00d7e177b9 100644
> --- a/drivers/mtd/nand/raw/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
> @@ -568,12 +568,9 @@ static void atmel_nfc_copy_to_sram(struct nand_chip *chip, const u8 *buf,
> struct mtd_info *mtd = nand_to_mtd(chip);
> struct atmel_nand *nand = to_atmel_nand(chip);
> struct atmel_hsmc_nand_controller *nc;
> - int ret = -EIO;
>
> nc = to_hsmc_nand_controller(nand->controller);
> -
> - if (ret)
> - memcpy_toio(nc->sram.virt, buf, mtd->writesize);
> + memcpy_toio(nc->sram.virt, buf, mtd->writesize);
>
> if (oob_required)
> memcpy_toio(nc->sram.virt + mtd->writesize, chip->oob_poi,
> @@ -586,12 +583,9 @@ static void atmel_nfc_copy_from_sram(struct nand_chip *chip, u8 *buf,
> struct mtd_info *mtd = nand_to_mtd(chip);
> struct atmel_nand *nand = to_atmel_nand(chip);
> struct atmel_hsmc_nand_controller *nc;
> - int ret = -EIO;
>
> nc = to_hsmc_nand_controller(nand->controller);
> -
> - if (ret)
> - memcpy_fromio(buf, nc->sram.virt, mtd->writesize);
> + memcpy_fromio(buf, nc->sram.virt, mtd->writesize);
>
> if (oob_required)
> memcpy_fromio(chip->oob_poi, nc->sram.virt + mtd->writesize,
> --
> 2.45.1
>
next prev parent reply other threads:[~2024-08-09 12:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 12:15 [PATCH] mtd: nand: raw: atmel: remove unnecessary return value Marcus Folkesson
2024-08-09 12:25 ` Alexander Dahl [this message]
2024-08-09 12:36 ` Michael Nazzareno Trimarchi
2024-08-09 13:05 ` Marcus Folkesson
2024-08-30 6:59 ` Marcus Folkesson
2024-08-30 7:05 ` Michael Nazzareno Trimarchi
2024-12-10 7:08 ` Marcus Folkesson
2024-12-10 7:12 ` Michael Nazzareno Trimarchi
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=20240809-challenge-causation-20cf58794b33@thorsis.com \
--to=ada@thorsis.com \
--cc=dario.binacchi@amarulasolutions.com \
--cc=eugen.hristev@collabora.com \
--cc=ivprusov@salutedevices.com \
--cc=marcus.folkesson@gmail.com \
--cc=michael@amarulasolutions.com \
--cc=seanga2@gmail.com \
--cc=trini@konsulko.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox