soundwire: debugfs: initialize ktime_t variables before div_u64
PATCH 1/1 soundwire: debugfs: initialize ktime_t variables before div_u64
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'.
--- drivers/soundwire/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soundwire/debugfs.c +2 -2
@@ -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 )
Signature · 1 line
2.49.0
Vinod Koul
maintainerQuoted 5 lines · Rodrigo Gobbi
The
start_tandfinish_tvariables are not properly initialized
if errors happens overrequest_firmwareactions. This was also detected by smatch:
drivers/soundwire/debugfs.c:301cmd_go()error: uninitialized symbol 'finish_t'.drivers/soundwire/debugfs.c:301cmd_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
Quoted 26 lines
Signed-off-by Rodrigo Gobbi <[email protected]>Reported-by Dan Carpenter <[email protected]>Fixes bb5cb09eedce ("soundwire: debugfs: add interface for BPT/BRA transfers")--- drivers/soundwire/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/soundwire/debugfs.c +2
-2@@ -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 )Signature · 1 line
2.49.0
Signature · 1 line
~Vinod