lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yg9Fbh//iSe+VAiT@matsya>
Date:   Fri, 18 Feb 2022 12:36:22 +0530
From:   Vinod Koul <vkoul@...nel.org>
To:     Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
Cc:     Bjorn Andersson <bjorn.andersson@...aro.org>,
        Wolfram Sang <wsa@...nel.org>, linux-arm-msm@...r.kernel.org,
        Andy Gross <agross@...nel.org>,
        Douglas Anderson <dianders@...omium.org>,
        Matthias Kaehlcke <mka@...omium.org>,
        linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
        Alexey Minnekhanov <alexeymin@...tmarketos.org>
Subject: Re: [PATCH v5] i2c: qcom-geni: Add support for GPI DMA

On 17-02-22, 20:51, Dmitry Baryshkov wrote:
> On Mon, 31 Jan 2022 at 15:04, Vinod Koul <vkoul@...nel.org> wrote:

> > +static int geni_i2c_fifo_xfer(struct geni_i2c_dev *gi2c,
> > +                             struct i2c_msg msgs[], int num)
> > +{
> > +       int i, ret = 0;
> > +
> > +       for (i = 0; i < num; i++) {
> > +               u32 m_param = i < (num - 1) ? STOP_STRETCH : 0;
> > +
> > +               m_param |= ((msgs[i].addr << SLV_ADDR_SHFT) & SLV_ADDR_MSK);
> > +
> > +               gi2c->cur = &msgs[i];
> > +               if (msgs[i].flags & I2C_M_RD)
> > +                       ret = geni_i2c_rx_one_msg(gi2c, &msgs[i], m_param);
> > +               else
> > +                       ret = geni_i2c_tx_one_msg(gi2c, &msgs[i], m_param);
> > +
> > +               if (ret)
> > +                       break;
> 
> I'd suggest to 'return ret' here and change the return line to 'return num'.

Done

> >  static int geni_i2c_xfer(struct i2c_adapter *adap,
> >                          struct i2c_msg msgs[],
> >                          int num)
> >  {
> >         struct geni_i2c_dev *gi2c = i2c_get_adapdata(adap);
> > -       int i, ret;
> > +       int ret;
> >
> >         gi2c->err = 0;
> >         reinit_completion(&gi2c->done);
> > @@ -475,22 +670,11 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
> >         }
> >
> >         qcom_geni_i2c_conf(gi2c);
> > -       for (i = 0; i < num; i++) {
> > -               u32 m_param = i < (num - 1) ? STOP_STRETCH : 0;
> > -
> > -               m_param |= ((msgs[i].addr << SLV_ADDR_SHFT) & SLV_ADDR_MSK);
> > -
> > -               gi2c->cur = &msgs[i];
> > -               if (msgs[i].flags & I2C_M_RD)
> > -                       ret = geni_i2c_rx_one_msg(gi2c, &msgs[i], m_param);
> > -               else
> > -                       ret = geni_i2c_tx_one_msg(gi2c, &msgs[i], m_param);
> >
> > -               if (ret)
> > -                       break;
> > -       }
> > -       if (ret == 0)
> > -               ret = num;
> > +       if (gi2c->gpi_mode)
> > +               ret = geni_i2c_gpi_xfer(gi2c, msgs, num);
> > +       else
> > +               ret = geni_i2c_fifo_xfer(gi2c, msgs, num);
> 
> We should return num if ret is 0 here (or in
> geni_i2c_fifo_xfer()/geni_i2c_gpi_xfer()).

I have picked your fix for that!
-- 
~Vinod

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ