* [PATCH v3 0/2] staging: greybus: audio: cleanups for gbaudio_module_update
@ 2026-06-14 15:43 Abdelnasser Hussein
2026-06-14 15:43 ` [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check Abdelnasser Hussein
2026-06-14 15:43 ` [PATCH v3 2/2] staging: greybus: audio_codec: remove redundant else-if check Abdelnasser Hussein
0 siblings, 2 replies; 6+ messages in thread
From: Abdelnasser Hussein @ 2026-06-14 15:43 UTC (permalink / raw)
To: gregkh
Cc: vaibhav.sr, mgreer, johan, elder, greybus-dev, linux-staging,
linux-kernel, Abdelnasser Hussein
This patch series addresses two separate issues in gbaudio_module_update()
that were previously combined in v2:
1. Fixes an improper check of the sscanf() return value (smatch warning).
2. Removes a redundant else-if check that could lead to an uninitialized
variable warning for 'ret' (reported by kernel test robot).
Changes in v3:
- Split the changes into a 2-patch series based on feedback from
Greg Kroah-Hartman.
- Assigned correct Reported-by and Closes tags to both patches.
abdelnasser hussein (2):
staging: greybus: audio_codec: fix sscanf return value check
staging: greybus: audio_codec: remove redundant else-if check
drivers/staging/greybus/audio_codec.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--
2.54.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check
2026-06-14 15:43 [PATCH v3 0/2] staging: greybus: audio: cleanups for gbaudio_module_update Abdelnasser Hussein
@ 2026-06-14 15:43 ` Abdelnasser Hussein
2026-06-15 7:35 ` Dan Carpenter
2026-06-14 15:43 ` [PATCH v3 2/2] staging: greybus: audio_codec: remove redundant else-if check Abdelnasser Hussein
1 sibling, 1 reply; 6+ messages in thread
From: Abdelnasser Hussein @ 2026-06-14 15:43 UTC (permalink / raw)
To: gregkh
Cc: vaibhav.sr, mgreer, johan, elder, greybus-dev, linux-staging,
linux-kernel, Abdelnasser Hussein, Dan Carpenter
Smatch static checker warns:
drivers/staging/greybus/audio_codec.c:335 gbaudio_module_update()
warn: sscanf doesn't return error codes
The sscanf() function returns the number of successfully matched input
items, not a negative error code. Compare the return value directly
with the expected number of conversions (3) instead of storing it in
'ret' and returning it as an error code, which leads to returning
a positive value on failure.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Closes: https://lore.kernel.org/all/YoOLnDkHgVltyXK7@kili/
Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@gmail.com>
---
Changes in v3:
- Split from the previous v2 patch into a separate patch.
- Updated tags to properly credit Dan Carpenter for the smatch warning.
drivers/staging/greybus/audio_codec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index 720aa752e17e..295222ec0f1a 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -311,8 +311,7 @@ int gbaudio_module_update(struct gbaudio_codec_info *codec,
}
/* parse dai_id from AIF widget's stream_name */
- ret = sscanf(w->sname, "%s %d %s", intf_name, &dai_id, dir);
- if (ret < 3) {
+ if (sscanf(w->sname, "%s %d %s", intf_name, &dai_id, dir) != 3) {
dev_err(codec->dev, "Error while parsing dai_id for %s\n", w->name);
return -EINVAL;
}
--
2.54.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 2/2] staging: greybus: audio_codec: remove redundant else-if check
2026-06-14 15:43 [PATCH v3 0/2] staging: greybus: audio: cleanups for gbaudio_module_update Abdelnasser Hussein
2026-06-14 15:43 ` [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check Abdelnasser Hussein
@ 2026-06-14 15:43 ` Abdelnasser Hussein
1 sibling, 0 replies; 6+ messages in thread
From: Abdelnasser Hussein @ 2026-06-14 15:43 UTC (permalink / raw)
To: gregkh
Cc: vaibhav.sr, mgreer, johan, elder, greybus-dev, linux-staging,
linux-kernel, Abdelnasser Hussein, kernel test robot
In gbaudio_module_update(), the widget id is validated earlier in the
function to ensure it is either snd_soc_dapm_aif_in or
snd_soc_dapm_aif_out.
Remove the redundant else-if check for snd_soc_dapm_aif_out. The
remaining branch can only handle snd_soc_dapm_aif_out, which avoids
a compiler warning about a potentially uninitialized variable.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202606140347.gGVWDnbi-lkp@intel.com/
Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@gmail.com>
---
Changes in v3:
- Split from the previous v2 patch to address the uninitialized variable
warning separately.
drivers/staging/greybus/audio_codec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index 295222ec0f1a..6daa4e706792 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -322,7 +322,7 @@ int gbaudio_module_update(struct gbaudio_codec_info *codec,
ret = gbaudio_module_enable_tx(codec, module, dai_id);
else
ret = gbaudio_module_disable_tx(module, dai_id);
- } else if (w->id == snd_soc_dapm_aif_out) {
+ } else {
if (enable)
ret = gbaudio_module_enable_rx(codec, module, dai_id);
else
--
2.54.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check
2026-06-14 15:43 ` [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check Abdelnasser Hussein
@ 2026-06-15 7:35 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2026-06-15 7:35 UTC (permalink / raw)
To: Abdelnasser Hussein
Cc: gregkh, vaibhav.sr, mgreer, johan, elder, greybus-dev,
linux-staging, linux-kernel, Dan Carpenter
On Sun, Jun 14, 2026 at 06:43:28PM +0300, Abdelnasser Hussein wrote:
> Smatch static checker warns:
> drivers/staging/greybus/audio_codec.c:335 gbaudio_module_update()
> warn: sscanf doesn't return error codes
>
> The sscanf() function returns the number of successfully matched input
> items, not a negative error code. Compare the return value directly
> with the expected number of conversions (3) instead of storing it in
> 'ret' and returning it as an error code, which leads to returning
> a positive value on failure.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Closes: https://lore.kernel.org/all/YoOLnDkHgVltyXK7@kili/
>
> Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@gmail.com>
There shouldn't be a blank line in the middle of the tags
block.
The closes tag isn't right...
https://lore.kernel.org/all/202103080429.X31wogmF-lkp@intel.com/
Sorry, this stuff is a bit confusing to everyone who is not involved
with the zero day bot. What happens is that for some warnings, they
first send the warning to me and I look it over and decide whether or
not it's valid. In this case, I decided it wasn't valid. Sure, I can
understand why the static checker thinks we're propagating the return
from sscanf() but actually the second else if is always true.
(I haven't actually checked that btw, I'm just assuming that the
second else if is always true. Static analysis is always a best
effort type of thing).
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check
2026-08-03 13:43 ` [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check Abdelnasser Hussein
@ 2026-08-03 15:29 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2026-08-03 15:29 UTC (permalink / raw)
To: Abdelnasser Hussein
Cc: jic23, nuno.sa, Michael.Hennerich, linux-iio, linux-kernel,
Dan Carpenter
On Mon, Aug 03, 2026 at 04:43:43PM +0300, Abdelnasser Hussein wrote:
> Smatch static checker warns:
> drivers/staging/greybus/audio_codec.c:335 gbaudio_module_update()
> warn: sscanf doesn't return error codes
>
> The sscanf() function returns the number of successfully matched input
> items, not a negative error code. Compare the return value directly
> with the expected number of conversions (3) instead of storing it in
> 'ret' and returning it as an error code, which leads to returning
> a positive value on failure.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Closes: https://lore.kernel.org/all/YoOLnDkHgVltyXK7@kili/
>
> Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@gmail.com>
> ---
> Changes in v3:
> - Split from the previous v2 patch into a separate patch.
> - Updated tags to properly credit Dan Carpenter for the smatch warning.
>
> drivers/staging/greybus/audio_codec.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
> index 720aa752e17e..295222ec0f1a 100644
> --- a/drivers/staging/greybus/audio_codec.c
> +++ b/drivers/staging/greybus/audio_codec.c
> @@ -311,8 +311,7 @@ int gbaudio_module_update(struct gbaudio_codec_info *codec,
> }
>
> /* parse dai_id from AIF widget's stream_name */
> - ret = sscanf(w->sname, "%s %d %s", intf_name, &dai_id, dir);
> - if (ret < 3) {
> + if (sscanf(w->sname, "%s %d %s", intf_name, &dai_id, dir) != 3) {
> dev_err(codec->dev, "Error while parsing dai_id for %s\n", w->name);
> return -EINVAL;
> }
> --
> 2.54.0
>
You didn't cc: the staging list? And the blank line above your
signed-off-by isn't going to work well. Please, when you split patches
up, be mindful of what tree they are going to.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check
2026-08-03 13:43 [PATCH v3 0/2] staging: iio: ad7816: Fix DMA from stack and race conditions Abdelnasser Hussein
@ 2026-08-03 13:43 ` Abdelnasser Hussein
2026-08-03 15:29 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Abdelnasser Hussein @ 2026-08-03 13:43 UTC (permalink / raw)
To: jic23
Cc: nuno.sa, Michael.Hennerich, gregkh, linux-iio, linux-kernel,
Abdelnasser Hussein, Dan Carpenter
Smatch static checker warns:
drivers/staging/greybus/audio_codec.c:335 gbaudio_module_update()
warn: sscanf doesn't return error codes
The sscanf() function returns the number of successfully matched input
items, not a negative error code. Compare the return value directly
with the expected number of conversions (3) instead of storing it in
'ret' and returning it as an error code, which leads to returning
a positive value on failure.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Closes: https://lore.kernel.org/all/YoOLnDkHgVltyXK7@kili/
Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@gmail.com>
---
Changes in v3:
- Split from the previous v2 patch into a separate patch.
- Updated tags to properly credit Dan Carpenter for the smatch warning.
drivers/staging/greybus/audio_codec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index 720aa752e17e..295222ec0f1a 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -311,8 +311,7 @@ int gbaudio_module_update(struct gbaudio_codec_info *codec,
}
/* parse dai_id from AIF widget's stream_name */
- ret = sscanf(w->sname, "%s %d %s", intf_name, &dai_id, dir);
- if (ret < 3) {
+ if (sscanf(w->sname, "%s %d %s", intf_name, &dai_id, dir) != 3) {
dev_err(codec->dev, "Error while parsing dai_id for %s\n", w->name);
return -EINVAL;
}
--
2.54.0
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-03 15:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-14 15:43 [PATCH v3 0/2] staging: greybus: audio: cleanups for gbaudio_module_update Abdelnasser Hussein
2026-06-14 15:43 ` [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check Abdelnasser Hussein
2026-06-15 7:35 ` Dan Carpenter
2026-06-14 15:43 ` [PATCH v3 2/2] staging: greybus: audio_codec: remove redundant else-if check Abdelnasser Hussein
2026-08-03 13:43 [PATCH v3 0/2] staging: iio: ad7816: Fix DMA from stack and race conditions Abdelnasser Hussein
2026-08-03 13:43 ` [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check Abdelnasser Hussein
2026-08-03 15:29 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®