Re: [PATCH v7 3/3] mtd: rawnand: Add Loongson-1 NAND Controller driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Keguang,

> > > +
> > > +                     nfc->data->parse_address(chip, addrs, naddrs, cmd);
> > > +                     /* set NAND address */
> > > +                     nand_writel(nfc, NAND_ADDR1, nfc->addr1_reg);
> > > +                     nand_writel(nfc, NAND_ADDR2, nfc->addr2_reg);
> > > +                     break;
> > > +             case NAND_OP_DATA_IN_INSTR:
> > > +             case NAND_OP_DATA_OUT_INSTR:
> > > +                     offset = nand_subop_get_data_start_off(subop, op_id);
> > > +                     nfc->len = nand_subop_get_data_len(subop, op_id);
> > > +                     if (instr->type == NAND_OP_DATA_IN_INSTR)
> > > +                             nfc->buf =
> > > +                                 (void *)instr->ctx.data.buf.in + offset;
> > > +                     else if (instr->type == NAND_OP_DATA_OUT_INSTR)
> > > +                             nfc->buf =
> > > +                                 (void *)instr->ctx.data.buf.out + offset;  
> >
> > The buf pointer feels clunky. You don't know for how long the buffer
> > you point to will be valid, please don't do that.
> >  
> The buf pointer is used for DMA transfer afterwards.
> I referred to other drivers, and they used the same approach.
> https://elixir.bootlin.com/linux/v6.8.9/source/drivers/mtd/nand/raw/arasan-nand-controller.c#L647

nfc_op is a local variable, it doesn't live past the function call.

> https://elixir.bootlin.com/linux/v6.8.9/source/drivers/mtd/nand/raw/rockchip-nand-controller.c#L366

Thanks,
Miquèl





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux