Clarification on unused variable in bin_patch_one_word_multiple_algs()
From: Dheeraj Reddy Jonnalagadda
Date: Thu Dec 19 2024 - 08:00:33 EST
Dear Maintainers,
While reviewing the bin_patch_one_word_multiple_algs function in the
cs_dsp_test_bin.c module, I came across an unused value warning flagged by
Coverity (CID 1602511). The issue is related to the variable alg_base_words,
which is assigned a value in the first for loop but is not utilized in that
loop. The value is later overwritten in the second loop, where it is used to
calculate register addresses.
The same issue is also detected in bin_patch_one_word_multiple_algs_unordered
function.
Link to the Coverity issues:
https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602511
https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602490
Given that alg_base_words in the first loop is not used and its value is
overwritten in the second loop, I wanted to confirm the intended behavior:
1. Is the assignment of alg_base_words in the first loop redundant,
and can it be safely removed?
2. Or is there a missed use case for alg_base_words within the first
loop that requires attention?
I appreciate your time. Please let me know if further context or details
are needed.
-Dheeraj