]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: sja1105: Do not use address of compatible member in sja1105_check_device_id
authorNathan Chancellor <natechancellor@gmail.com>
Fri, 21 Aug 2020 22:25:16 +0000 (15:25 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Aug 2020 23:13:25 +0000 (16:13 -0700)
commit090e897df91c8f92598d06b0638a23de01d26c13
treeba4b177895c845b07762e370b169605ff3180ad1
parent54f8044685392360c3122d1d3551f4d9cd3a3a09
net: dsa: sja1105: Do not use address of compatible member in sja1105_check_device_id

Clang warns:

drivers/net/dsa/sja1105/sja1105_main.c:3418:38: warning: address of
array 'match->compatible' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        for (match = sja1105_dt_ids; match->compatible; match++) {
        ~~~                          ~~~~~~~^~~~~~~~~~
1 warning generated.

We should check the value of the first character in compatible to see if
it is empty or not. This matches how the rest of the tree iterates over
IDs.

Fixes: ca1638ee6230 ("net: dsa: sja1105: use detected device id instead of DT one on mismatch")
Link: https://github.com/ClangBuiltLinux/linux/issues/1139
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/sja1105_main.c