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

Jarkko Nikula jhnikula at gmail.com
Tue Aug 3 08:26:57 CEST 2010


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".

Signed-off-by: Jarkko Nikula <jhnikula at gmail.com>
---
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(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 5c10439..300a9b3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -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)
-- 
1.7.1



More information about the Alsa-devel mailing list