re: net: dsa: sja1105: use detected device id instead of DT one on mismatch

From: Colin Ian King
Date: Thu Aug 06 2020 - 13:55:27 EST


Hi,

Static analysis with Coverity has detected a potential issue with the
following commit:

commit 0b0e299720bb99428892a23ecbd2b4b7f61ccf6d
Author: Vladimir Oltean <olteanv@xxxxxxxxx>
Date: Mon Aug 3 19:48:23 2020 +0300

net: dsa: sja1105: use detected device id instead of DT one on mismatch

The analysis is as follows:

Array compared against 0 (NO_EFFECT)array_null: Comparing an array to
null is not useful: match->compatible, since the test will always
evaluate as true.

Was match->compatible formerly declared as a pointer?

3418 for (match = sja1105_dt_ids; match->compatible; match++) {
3419 const struct sja1105_info *info = match->data;
3420

I'm not sure what the original intention was, so I was unable to fix
this hence I'm sending this report as I think it needs addressing.

Colin