Re: [PATCH v3 1/2] staging: greybus: audio_codec: fix sscanf return value check

From: Dan Carpenter

Date: Mon Jun 15 2026 - 03:35:36 EST


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@xxxxxxxxxx>
> Closes: https://lore.kernel.org/all/YoOLnDkHgVltyXK7@kili/
>
> Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@xxxxxxxxx>

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@xxxxxxxxx/
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