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: <3eeda38b-0bfa-4b46-8088-303f78b5f340@baylibre.com>
Date: Mon, 18 Mar 2024 17:48:39 -0500
From: David Lechner <dlechner@...libre.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
 Michael Hennerich <michael.hennerich@...log.com>,
 Nuno Sá <nuno.sa@...log.com>, linux-iio@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: ad7944: simplify adi,spi-mode property parsing

On 3/18/24 5:43 PM, Andy Shevchenko wrote:
> On Mon, Mar 18, 2024 at 11:57 PM David Lechner <dlechner@...libre.com> wrote:
>>
>> This simplifies the adi,spi-mode property parsing by using
>> device_property_match_property_string() instead of two separate
>> functions. Also, the error return value is now more informative
>> in cases where there was problem parsing the property.
> 
> a problem
> 
> ...
> 
>> +       ret = device_property_match_property_string(dev, "adi,spi-mode",
>> +                                                   ad7944_spi_modes,
>> +                                                   ARRAY_SIZE(ad7944_spi_modes));
>> +       if (ret < 0) {
>>                 /* absence of adi,spi-mode property means default mode */
>> -               adc->spi_mode = AD7944_SPI_MODE_DEFAULT;
>> +               if (ret == -EINVAL)
>> +                       adc->spi_mode = AD7944_SPI_MODE_DEFAULT;
>> +               else
>> +                       return dev_err_probe(dev, ret,
>> +                                            "getting adi,spi-mode property failed\n");
> 
> No need to have 'else'
> 
>                if (ret != -EINVAL)
>                        return dev_err_probe(dev, ret, "getting
> adi,spi-mode property failed\n");
> 
>                /* absence of adi,spi-mode property means default mode */
>                adc->spi_mode = AD7944_SPI_MODE_DEFAULT;
> 
>> +       } else {
>> +               adc->spi_mode = ret;
>>         }
> 

I agree it is better that way. Will send a v2.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ