[PATCH] mtd: nand: raw: atmel: remove unnecessary return value
Michael Nazzareno Trimarchi
michael at amarulasolutions.com
Fri Aug 9 14:36:44 CEST 2024
Hi all
On Fri, Aug 9, 2024 at 2:25 PM Alexander Dahl <ada at thorsis.com> wrote:
>
> 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.
>
I suggest to comment it because it will happen to other people to send a similar
patch
Michael
> Greets
> Alex
>
> >
> > Remove 'ret' and the condition for copy.
> >
> > Signed-off-by: Marcus Folkesson <marcus.folkesson at 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
> >
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael at amarulasolutions.com
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info at amarulasolutions.com
www.amarulasolutions.com
More information about the U-Boot
mailing list