diff mbox series

soundwire: bus: Fix device found flag correctly

Message ID 20210308113752.19661-1-srinivas.kandagatla@linaro.org (mailing list archive)
State Superseded
Headers show
Series soundwire: bus: Fix device found flag correctly | expand

Commit Message

Srinivas Kandagatla March 8, 2021, 11:37 a.m. UTC
found flag that is used to indicate SoundWire device on the bus is
not reset correctly after one iteration, this could miss adding devices
that are enumerated on the bus but on in device list.

Fixes: d52d7a1be02c ("soundwire: Add Slave status handling helpers")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Pierre-Louis Bossart March 8, 2021, 3:51 p.m. UTC | #1
On 3/8/21 5:37 AM, Srinivas Kandagatla wrote:
> found flag that is used to indicate SoundWire device on the bus is
> not reset correctly after one iteration, this could miss adding devices
> that are enumerated on the bus but on in device list.

typo? did you mean "enumerated on the bus but not on device list"?

if yes, the first part is ambiguous in its wording, the enumeration 
completes by programming a device number. At this point the device is 
only 'attached'.

The fix is correct otherwise, please add my tag if you change the commit 
message in a v2.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>


> 
> Fixes: d52d7a1be02c ("soundwire: Add Slave status handling helpers")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>   drivers/soundwire/bus.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> index a9ab4a6264e0..188e391c5a83 100644
> --- a/drivers/soundwire/bus.c
> +++ b/drivers/soundwire/bus.c
> @@ -712,7 +712,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;
>   
> @@ -744,6 +744,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) {
>
diff mbox series

Patch

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index a9ab4a6264e0..188e391c5a83 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -712,7 +712,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;
 
@@ -744,6 +744,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) {