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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeXBCqEhfna2mQaHv7bZKOrj+A6KkbCrMAfM=X9+boDjA@mail.gmail.com>
Date:   Thu, 16 Jul 2020 13:14:13 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Rayagonda Kokatanur <rayagonda.kokatanur@...adcom.com>
Cc:     Wolfram Sang <wsa@...nel.org>,
        linux-i2c <linux-i2c@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Ray Jui <rjui@...adcom.com>,
        Scott Branden <sbranden@...adcom.com>,
        bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
        Lori Hikichi <lori.hikichi@...adcom.com>,
        Robert Richter <rrichter@...vell.com>,
        Nishka Dasgupta <nishkadg.linux@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH V1 2/2] i2c: iproc: add slave pec support

On Thu, Jul 16, 2020 at 11:14 AM Rayagonda Kokatanur
<rayagonda.kokatanur@...adcom.com> wrote:
>
> Iproc supports PEC computation and checking in both Master
> and Slave mode.
>
> This patch adds support for PEC in slave mode.

...

> -#define S_RX_PEC_ERR_SHIFT           29
> +#define S_RX_PEC_ERR_SHIFT           28
> +#define S_RX_PEC_ERR_MASK            0x3
> +#define S_RX_PEC_ERR                 0x1

This needs to be explained in the commit message, in particular why
this change makes no regression.

...

> +static int bcm_iproc_smbus_check_slave_pec(struct bcm_iproc_i2c_dev *iproc_i2c,
> +                                          u32 val)
> +{
> +       u8 err_status;

> +       int ret = 0;

Completely redundant variable.

> +       if (!iproc_i2c->en_s_pec)
> +               return ret;

return 0;

> +       err_status = (u8)((val >> S_RX_PEC_ERR_SHIFT) & S_RX_PEC_ERR_MASK);

Why casting?

> +       if (err_status == S_RX_PEC_ERR) {
> +               dev_err(iproc_i2c->device, "Slave PEC error\n");

> +               ret = -EBADMSG;

return ...

> +       }
> +
> +       return ret;

return 0;

> +}

...

> +                       if (rx_status == I2C_SLAVE_RX_END) {
> +                               int ret;
> +
> +                               ret = bcm_iproc_smbus_check_slave_pec(iproc_i2c,
> +                                                                     val);

One line looks better.

> +                               if (!ret)

Why not positive conditional?

> +                                       i2c_slave_event(iproc_i2c->slave,
> +                                                       I2C_SLAVE_STOP, &value);
> +                               else
> +                                       i2c_slave_event(iproc_i2c->slave,
> +                                                       I2C_SLAVE_PEC_ERR,
> +                                                       &value);
> +                       }

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ