Re: [PATCH v2 2/2] i2c: Add Renesas RZ/V2M controller

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

 



Hi Andy,

On Wed, Jun 29, 2022 at 12:46 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> On Wed, Jun 29, 2022 at 08:52:27AM +0200, Geert Uytterhoeven wrote:
> > On Tue, Jun 28, 2022 at 11:08 PM Andy Shevchenko
> > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > > On Tue, Jun 28, 2022 at 08:45:26PM +0100, Phil Edworthy wrote:
>
> ...
>
> > > > +static int rzv2m_i2c_send(struct rzv2m_i2c_priv *priv, struct i2c_msg *msg,
> > > > +                       unsigned int *count)
> > > > +{
> > > > +     unsigned int i;
> > > > +     int ret = 0;
> > >
> > > Redundant assignment, you may return 0 directly.
> >
> > Can you prove msg->len is never zero, and the loop below is always
> > executed at least once?
>
> I don't see how this is related. The ret is used only in the loop body,
>
>         return 0;
>
> outside will suffice. No?

Right, with the "return ret" in the end replaced.

> > The driver does set I2C_AQ_NO_ZERO_LEN, but I don't think the static
> > checkers know ;-)
> >
> > >
> > > > +     for (i = 0; i < msg->len; i++) {
> > > > +             ret = rzv2m_i2c_write_with_ack(priv, msg->buf[i]);
> > > > +             if (ret < 0)
> > > > +                     return ret;
> > > > +     }
> > > > +     *count = i;
> > > > +
> > > > +     return ret;
> > > > +}

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux