Messages in this thread | | | Date | Wed, 29 Jun 2022 11:42:22 -0500 | Subject | Re: [PATCH 2/4] ASoC: codecs: add wsa883x amplifier support | From | Pierre-Louis Bossart <> |
| |
>>> +static int wsa883x_update_status(struct sdw_slave *slave, >>> + enum sdw_slave_status status) >>> +{ >>> + struct wsa883x_priv *wsa883x = dev_get_drvdata(&slave->dev); >>> + >>> + if (status == SDW_SLAVE_ATTACHED && slave->dev_num > 0) >> >> do you actually need to test if slave->dev_num is > 0? >> > Few years back I think it was you who asked me to add this check.. :-) > > https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2073074.html
Oops!
My comment was valid in general but at the bus level. With the benefit of hindsight, I don't think this comment is valid in this callback.
update_status is either called with UNATTACHED, or with ATTACHED/ALERT after programming dev_num to a value > 0.
It's not wrong to leave the code as is, but it's likely to be an always-true condition.
| |