[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aFD9IVIUt1n7xJG4@vaman>
Date: Tue, 17 Jun 2025 10:59:05 +0530
From: Vinod Koul <vkoul@...nel.org>
To: Rodrigo Gobbi <rodrigo.gobbi.7@...il.com>
Cc: yung-chuan.liao@...ux.intel.com, pierre-louis.bossart@...ux.dev,
sanyog.r.kale@...el.com, ~lkcamp/patches@...ts.sr.ht,
linux-sound@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] soundwire: debugfs: initialize ktime_t variables before
div_u64
On 16-06-25, 22:48, Rodrigo Gobbi wrote:
> The start_t and finish_t variables are not properly initialized
> if errors happens over request_firmware actions. This was also detected by smatch:
>
> drivers/soundwire/debugfs.c:301 cmd_go() error: uninitialized symbol 'finish_t'.
> drivers/soundwire/debugfs.c:301 cmd_go() error: uninitialized symbol 'start_t'.
Should we care about debug statement printing wrong time on error...
Rather than do this, better to move debug statement up so that it is not
executed on error scenario
>
> Signed-off-by: Rodrigo Gobbi <rodrigo.gobbi.7@...il.com>
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Closes: https://lore.kernel.org/linux-sound/0db6d0bf-7bac-43a7-b624-a00d3d2bf829@stanley.mountain/
> Fixes: bb5cb09eedce ("soundwire: debugfs: add interface for BPT/BRA transfers")
> ---
> drivers/soundwire/debugfs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soundwire/debugfs.c b/drivers/soundwire/debugfs.c
> index 3099ea074f10..951fc255e4eb 100644
> --- a/drivers/soundwire/debugfs.c
> +++ b/drivers/soundwire/debugfs.c
> @@ -237,8 +237,8 @@ static int cmd_go(void *data, u64 value)
> {
> const struct firmware *fw = NULL;
> struct sdw_slave *slave = data;
> - ktime_t start_t;
> - ktime_t finish_t;
> + ktime_t start_t = 0;
> + ktime_t finish_t = 0;
> int ret;
>
> if (value != 1)
> --
> 2.49.0
--
~Vinod
Powered by blists - more mailing lists