diff mbox series

spi: fix erroneous logic inversion in spi_match_id() usage

Message ID 44b2ad71-dc4b-801c-237f-9c233f675c0d@gmail.com
State New
Headers show
Series spi: fix erroneous logic inversion in spi_match_id() usage | expand

Commit Message

Heiner Kallweit Nov. 30, 2021, 8:13 p.m. UTC
We want to continue in case of a match. Fix the erroneously inverted
logic.

Fixes: 3f07657506df ("spi: deduplicate spi_match_id() in __spi_register_driver()")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/spi/spi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Andy Shevchenko Dec. 1, 2021, 7:18 p.m. UTC | #1
On Wed, Dec 01, 2021 at 07:49:19PM +0100, Heiner Kallweit wrote:
> On 01.12.2021 16:41, Mark Brown wrote:
> > On Tue, Nov 30, 2021 at 09:13:35PM +0100, Heiner Kallweit wrote:
> > 
> >> We want to continue in case of a match. Fix the erroneously inverted
> >> logic.
> > 
> > We do?  Why?  I can't tell from this changelog what the problem is or
> > why the patch would fix it.

Isn't it fixed by b79332ef9d61 ("spi: Fix condition in the
__spi_register_driver()")?
Heiner Kallweit Dec. 1, 2021, 7:54 p.m. UTC | #2
On 01.12.2021 20:18, Andy Shevchenko wrote:
> On Wed, Dec 01, 2021 at 07:49:19PM +0100, Heiner Kallweit wrote:
>> On 01.12.2021 16:41, Mark Brown wrote:
>>> On Tue, Nov 30, 2021 at 09:13:35PM +0100, Heiner Kallweit wrote:
>>>
>>>> We want to continue in case of a match. Fix the erroneously inverted
>>>> logic.
>>>
>>> We do?  Why?  I can't tell from this changelog what the problem is or
>>> why the patch would fix it.
> 
> Isn't it fixed by b79332ef9d61 ("spi: Fix condition in the
> __spi_register_driver()")?
> 
> 
Indeed, it has been fixed with this commit. I was using linux-next from
Nov 24th that included the first change but not yet the fix.
Sorry for the noise.
diff mbox series

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 5bf680fcb..4578c2fb5 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -471,10 +471,7 @@  int __spi_register_driver(struct module *owner, struct spi_driver *sdrv)
 				of_name = of_id->compatible;
 
 			if (sdrv->id_table) {
-				const struct spi_device_id *spi_id;
-
-				spi_id = spi_match_id(sdrv->id_table, of_name);
-				if (!spi_id)
+				if (spi_match_id(sdrv->id_table, of_name))
 					continue;
 			} else {
 				if (strcmp(sdrv->driver.name, of_name) == 0)