ASoC: Fix warning from strict_strtoul()
PATCH 1/1 ASoC: Fix warning from strict_strtoul()
--- sound/soc/soc-dapm.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
sound/soc/soc-dapm.c +5 -1
@@ -808,7 +808,11 @@ static ssize_t dapm_pop_time_store(struct device *dev, const char *buf, size_t count) { - if (strict_strtoul(buf, 10, &pop_time) < 0) +unsigned long val; + +if (strict_strtoul (buf,10 , &val) >=0 ) + pop_time = val; +else printk (KERN_ERR "Unable to parse pop_time setting\n" );return count;
Signature · 1 line
1.5.6
Takashi Iwai
AppliedAt Fri, 4 Jul 2008 16:01:14 +0100,
Quoted 2 lines · Mark Brown
Signed-off-by Mark Brown <[email protected]>
Thanks, applied.
(BTW, at the next time, a bit more patch description would be helpful.
For example, in this case, it's actually not about warning but the behavior of strict_strtoul() that resets the value, if I understand correctly.)
Takashi
Quoted 24 lines
--- sound/soc/soc-dapm.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)sound/soc/soc-dapm.c +5
-1@@ -808,7 +808,11 @@ static ssize_t dapm_pop_time_store(struct device *dev, const char *buf, size_t count) { - if (strict_strtoul(buf, 10, &pop_time) < 0) +unsigned long val; + +if (strict_strtoul (buf,10 , &val) >=0 ) + pop_time = val; +else printk (KERN_ERR "Unable to parse pop_time setting\n" );return count;Signature · 1 line
1.5.6
Quoted 4 lines · Takashi Iwai
(BTW, at the next time, a bit more patch description would be helpful.
For example, in this case, it's actually not about warning but the behavior ofstrict_strtoul()that resets the value, if I understand correctly.)
It is a warning fix - I was passing the wrong type of variable to strict_strtoul(), though on most architectures int and long are the same in memory so the behaviour before and after the change is identical. The fix is to pass a temporary variable of the correct type in and then assign the result to pop_time rather than passing pop_time in directly.
At Fri, 4 Jul 2008 20:57:54 +0100,
Quoted 7 lines · Mark Brown
Quoted 4 lines · Takashi Iwai
(BTW, at the next time, a bit more patch description would be helpful.
For example, in this case, it's actually not about warning but the behavior ofstrict_strtoul()that resets the value, if I understand correctly.)
Quoted 5 lines
It is a warning fix - I was passing the wrong type of variable to
strict_strtoul(), though on most architectures int and long are the same in memory so the behaviour before and after the change is identical. The fix is to pass a temporary variable of the correct type in and then assign the result topop_timerather than passingpop_timein directly.
Ah, OK, that I totally missed.
Anyway this also fixes another strange behavior - strict_strtoul() stores 0 when it gets a parse error. So, in the older version, the pop_wait itself is reset to 0 at error while the value is kept in the newer version.
thanks,
Takashi
Quoted 4 lines · Takashi Iwai
Anyway this also fixes another strange behavior -
strict_strtoul()stores 0 when it gets a parse error. So, in the older version, thepop_waititself is reset to 0 at error while the value is kept in the newer version.
Oh, so it does - how unhelpful (if understandable) of strict_strtoul(). Good job I decided to do this fix rather than changing the type of pop_time :)