Skip to contentSkip to conversation

ASoC: multi-component - Fix DAI ID scanning from device name

PATCH In review Jarkko Nikula 2 participants 3 messages Aug 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ASoC: multi-component - Fix DAI ID scanning from device name

Format string specifier ".%d" for sscanf cannot scan integer from a string "driver-name.123". Fix this by starting the scan from a position after "driver-name".

---
Liam. This is a trivial fix. No need for separate patch, just embed to your next multi-component update. I noticed this because dai->id in mcbsp_dai_probe was always zero.

---
 sound/soc/soc-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/soc-core.c +1 -1
index 5c10439..300a9b3 100644
@@ -2803,7 +2803,7 @@ static inline char *fmt_single_name(struct device *dev, int *id)
 	found = strstr(name, dev->driver->name);
 	if (found) {
 		/* get ID */
-		if (sscanf(found,".%d", id) == 1) {
+		if (sscanf(&found[strlen(dev->driver->name)], ".%d", id) == 1) {
 
 			/* discard ID from name if ID == -1 */
 			if (*id == -1)
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/2 ASoC: multi-component - Fix ".-1" removal from device name

Function fmt_single_name returns empty name if device name is "driver-name.-1".

---
Liam. This is a trivial fix. No need for separate patch, just embed to your next multi-component update. Do we even have a case where name is "foo-bar.-1"?

---
 sound/soc/soc-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/soc-core.c +1 -1
index 300a9b3..db7ea1b 100644
@@ -2807,7 +2807,7 @@ static inline char *fmt_single_name(struct device *dev, int *id)
 
 			/* discard ID from name if ID == -1 */
 			if (*id == -1)
-				*found = '\0';
+				found[strlen(dev->driver->name)] = '\0';
 		}
 
 	} else {
Signature · 1 line
1.7.1
#2 lore raw
In reply to Jarkko Nikula
Quoted 10 lines · Jarkko Nikula

Format string specifier ".%d" for sscanf cannot scan integer from a string "driver-name.123". Fix this by starting the scan from a position after "driver-name".

---
Liam. This is a trivial fix. No need for separate patch, just embed to your next multi-component update. I noticed this because dai->id in mcbsp_dai_probe was always zero.
---

Thanks

Both Applied.

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk