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]
Date:   Wed, 11 Aug 2021 10:03:49 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Mugilraj Dhavachelvan <dmugil2000@...il.com>
Cc:     "Bogdan, Dragos" <Dragos.Bogdan@...log.com>,
        Darius <Darius.Berghe@...log.com>,
        Rob Herring <robh+dt@...nel.org>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        Guenter Roeck <linux@...ck-us.net>,
        Chris Packham <chris.packham@...iedtelesis.co.nz>,
        Slawomir Stepien <sst@...zta.fm>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-iio <linux-iio@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] iio: potentiometer: Add driver support for AD5110

On Wed, Aug 11, 2021 at 8:46 AM Mugilraj Dhavachelvan
<dmugil2000@...il.com> wrote:
> On Tue, Aug 10, 2021 at 03:49:52PM +0300, Andy Shevchenko wrote:
> > On Mon, Aug 9, 2021 at 10:59 AM Mugilraj Dhavachelvan
> > <dmugil2000@...il.com> wrote:

...

> > > +       data->tol = data->cfg->kohms * (val & GENMASK(6, 0)) * 10 / 8;
> > > +       if (!(val & BIT(7)))
> > > +               data->tol *= -1;
> >
> > Shouldn't you simple use corresponding sign_extend*()?
> >
> I'm not able see any sign_extend for 16 bit. Is there any other way?

So, then add it in bitops.h the same way it's done for s32 and s64.

...

> > > +       if (!data->cfg)
> > > +               data->cfg = &ad5110_cfg[i2c_match_id(ad5110_id, client)->driver_data];
> >
> > Not sure this is not a dead code since you are using ->probe_new().
> >
> Even I'm suspecting that and also removing id_table. But I'm not sure of
> it so just left as it is.

I²C ID table is good to have without direct use, but ->probe_new() is
called if and only if there is a compatible string or ACPI ID match.
In such case data->cfg may be NULL if and only if the corresponding
table missed it, but this will be a bug anyway, so the above code will
rather hide the bug. Hence, please remove it.


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ