]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
soundwire: bus: Fix device found flag correctly
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tue, 9 Mar 2021 10:48:16 +0000 (10:48 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 07:44:19 +0000 (09:44 +0200)
[ Upstream commit f03690f4f6992225d05dbd1171212e5be5a370dd ]

found flag is used to indicate SoundWire devices that are
both enumerated on the bus and available in the device list.
However this flag is not reset correctly after one iteration,
This could miss some of the devices that are enumerated on the
bus but not in device list. So reset this correctly to fix this issue!

Fixes: d52d7a1be02c ("soundwire: Add Slave status handling helpers")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210309104816.20350-1-srinivas.kandagatla@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soundwire/bus.c

index a90963812357c737c2aa158bb20f19d64336535b..d90f00d09257a2a6508a3792904994dd830273f8 100644 (file)
@@ -525,7 +525,7 @@ static int sdw_program_device_num(struct sdw_bus *bus)
        struct sdw_slave *slave, *_s;
        struct sdw_slave_id id;
        struct sdw_msg msg;
-       bool found = false;
+       bool found;
        int count = 0, ret;
        u64 addr;
 
@@ -557,6 +557,7 @@ static int sdw_program_device_num(struct sdw_bus *bus)
 
                sdw_extract_slave_id(bus, addr, &id);
 
+               found = false;
                /* Now compare with entries */
                list_for_each_entry_safe(slave, _s, &bus->slaves, node) {
                        if (sdw_compare_devid(slave, id) == 0) {