public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soundwire: qcom: Check device status before reading devid
@ 2022-07-06  9:56 Srinivas Kandagatla
  2022-07-06 16:45 ` Vinod Koul
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Kandagatla @ 2022-07-06  9:56 UTC (permalink / raw)
  To: vkoul
  Cc: yung-chuan.liao, pierre-louis.bossart, alsa-devel, linux-arm-msm,
	Srinivas Kandagatla, stable

As per hardware datasheet its recommended that we check the device
status before reading devid assigned by auto-enumeration.

Without this patch we see SoundWire devices with invalid enumeration
addresses on the bus.

Cc: stable@vger.kernel.org
Fixes: a6e6581942ca ("soundwire: qcom: add auto enumeration support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index dbf793e7e5d7..9df970eeca45 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -480,6 +480,10 @@ static int qcom_swrm_enumerate(struct sdw_bus *bus)
 	char *buf1 = (char *)&val1, *buf2 = (char *)&val2;
 
 	for (i = 1; i <= SDW_MAX_DEVICES; i++) {
+		/* do not continue if the status is Not Present  */
+		if (!ctrl->status[i])
+			continue;
+
 		/*SCP_Devid5 - Devid 4*/
 		ctrl->reg_read(ctrl, SWRM_ENUMERATOR_SLAVE_DEV_ID_1(i), &val1);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-13 14:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-06  9:56 [PATCH] soundwire: qcom: Check device status before reading devid Srinivas Kandagatla
2022-07-06 16:45 ` Vinod Koul
2022-08-13 14:12   ` Amit Pundir
2022-08-13 14:23     ` Amit Pundir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox