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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9420b802-5361-4f47-a069-52c43f5fd253@broadcom.com>
Date: Wed, 13 Mar 2024 11:37:45 -0700
From: Florian Fainelli <florian.fainelli@...adcom.com>
To: Pratyush Yadav <pratyush@...nel.org>, Michael Walle <mwalle@...nel.org>
Cc: linux-spi@...r.kernel.org, Mark Brown <broonie@...nel.org>,
 Miquel Raynal <miquel.raynal@...tlin.com>,
 Mika Westerberg <mika.westerberg@...ux.intel.com>,
 "Chia-Lin Kao (AceLan)" <acelan.kao@...onical.com>,
 open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] spi: Fix error code checking in spi_mem_exec_op()

On 3/13/24 11:28, Pratyush Yadav wrote:
> On Wed, Mar 13 2024, Michael Walle wrote:
> 
>> On Wed Mar 13, 2024 at 6:10 PM CET, Florian Fainelli wrote:
>>> After commit cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with
>>> -EOPNOTSUPP"), our SPI NOR flashes would stop probing with the following
>>> visible in the kernel log:
>>>
>>> [    2.196300] brcmstb_qspi f0440920.qspi: using bspi-mspi mode
>>> [    2.210295] spi-nor: probe of spi1.0 failed with error -95
>>>
>>> It turns out that the check in spi_mem_exec_op() was changed to check
>>> for -ENOTSUPP (old error code) or -EOPNOTSUPP (new error code), but this
>>> means that for drivers that were converted, the second condition is now
>>> true, and we stop falling through like we used to. Fix the error to
>>> check for neither error being neither -ENOTSUPP *nor* -EOPNOTSUPP.
>>>
>>> Fixes: cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP")
>>> Signed-off-by: Florian Fainelli <florian.fainelli@...adcom.com>
>>> Change-Id: I4159811f6c582c4de2143382473d2000b8755872
>>
>> Ha, thank you!
>>
>> Reviewed-by: Michael Walle <mwalle@...nel.org>
>>
>> FWIW in next, there is commit
>> e63aef9c9121e ("spi: spi-mem: add statistics support to ->exec_op() calls")
>> that probably will conflict with this one.
>>
>> Also, - not for this patch - but with that logic, spi_mem_exec_op()
>> might return EOPNOTSUPP *or* ENOTSUPP, even for drivers which might
>> still return ENOTSUPP, because there is one condition in
>> spi_mem_exec_op() which will always return EOPNOTSUPP. That is
>> somewhat confusing, no?
> 
> I agree. I suppose it would be better to do:
> 
>      if (!ret)
>         return 0;
> 
>      if (ret == -ENOTSUPP || ret == -EOPNOTSUPP)
>         return -EOPNOTSUPP;
> 

But with e63aef9c9121e ("spi: spi-mem: add statistics support to 
->exec_op() calls") applied, would not that mean duplicating the 
statistics gathering, or were the statistics gathering only intended for 
when ret == 0?
-- 
Florian


Download attachment "smime.p7s" of type "application/pkcs7-signature" (4221 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ