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: <ZNM1AYMB3RGRWp7C@gmail.com>
Date:   Wed, 9 Aug 2023 08:41:05 +0200
From:   Marcus Folkesson <marcus.folkesson@...il.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Kent Gustavsson <kent@...oris.se>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Cosmin Tanislav <demonsingur@...il.com>,
        Arnd Bergmann <arnd@...db.de>,
        ChiYuan Huang <cy_huang@...htek.com>,
        Haibo Chen <haibo.chen@....com>,
        Ramona Bolboaca <ramona.bolboaca@...log.com>,
        Ibrahim Tilki <Ibrahim.Tilki@...log.com>,
        ChiaEn Wu <chiaen_wu@...htek.com>,
        William Breathitt Gray <william.gray@...aro.org>,
        linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 4/4] iio: adc: mcp3911: add support for the whole
 MCP39xx family

> ...
> 
> > +#define MCP3910_OFFCAL(x)		(MCP3910_REG_OFFCAL_CH0 + x * 6)
> 
> Inconsistent macro implementation, i.e. you need to use (x).

Sorry, I do not get you


[...]

> > +static int mcp3910_get_osr(struct mcp3911 *adc, int *val)
> > +{
> > +	int ret, osr;
> 
> Strictly speaking osr can't be negative, otherwise it's a UB below.
> 
> 	u32 osr = FIELD_GET(MCP3910_CONFIG0_OSR, *val);
> 	int ret;
> 
> and why val is int?

I will change val to u32 for *_get_osr(), *_set_osr() and *_set_scale().

[...]

> > +	if (device_property_read_bool(&adc->spi->dev, "microchip,data-ready-hiz"))
> 
> This also becomes shorter.
> 
> One trick to make it even shorter:
> 
> 	if (device_property_present(dev, "microchip,data-ready-hiz"))

Thank you, I wasn't aware of device_property_present().

[...]

> 
> > +	dev_dbg(&spi->dev, "use device address %i\n", adc->dev_addr);
> 
> Is it useful?

Yes, I think so.

> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

Best regards,
Marcus Folkesson

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ