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]
Date:   Wed, 7 Apr 2021 10:43:15 +0530
From:   Puranjay Mohan <puranjay12@...il.com>
To:     Lars-Peter Clausen <lars@...afoo.de>
Cc:     alexandru.ardelean@...log.com, Jonathan Cameron <jic23@...nel.org>,
        devicetree@...r.kernel.org, knaack.h@....de,
        linux-iio <linux-iio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [PATCH v3 2/2] iio: temperature: add driver support for ti tmp117

On Wed, Apr 7, 2021 at 10:26 AM Lars-Peter Clausen <lars@...afoo.de> wrote:
>
> On 4/6/21 8:28 PM, Puranjay Mohan wrote:
> > +
> > +static int tmp117_write_raw(struct iio_dev *indio_dev,
> > +             struct iio_chan_spec const *channel, int val,
> > +             int val2, long mask)
> > +{
> > +     struct tmp117_data *data = iio_priv(indio_dev);
> > +     s16 off;
> > +
> > +     switch (mask) {
> > +     case IIO_CHAN_INFO_CALIBBIAS:
> > +             off = clamp(val, -32768, 32767);
> > +             if (off == data->calibbias)
>
> data->calibbias is only set in probe() and always 0. I'm not sure we
> need to cache the value. Reading it back from the device seems fine.
I forgot to update it, thanks for finding the bug.
Actually, I wanted to update the calibbias register only if a
different value is being written.
If the same value is written to the device repeatedly then we can save
some I2C writes using this.

and while reading the calibbias, it is read from the device only.
I will fix the bug in the next revision.

>
> > +                     return 0;
> > +             return i2c_smbus_write_word_swapped(data->client,
> > +                                             TMP117_REG_TEMP_OFFSET, off);
> > +
> > +     default:
> > +             return -EINVAL;
> > +     }
> > +}
> > +
>


-- 
Thanks and Regards

Yours Truly,

Puranjay Mohan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ