hi all,
My name is Ragavendra and I have about fifteen years of work experience in the IT industry mostly in web development. However I did diploma in embedded systems in CDAC in 2005 and have been using Linux since then. I submitted my first patch in 2015 and am planning to contribute again now for a while.
I went over the emails in the mailing list for the last few weeks or months to see how I can contribute. As a result, I signed up in Coverity and found one issue I thought I can help is say with the `1585136 Uninitialized scalar variable`.
////
diff --git a/drivers/clk/sophgo/clk-cv18xx-pll.c b/drivers/clk/sophgo/clk-cv18xx-pll.c
index 29e24098bf5f..a39a14fc39c2 100644
--- a/drivers/clk/sophgo/clk-cv18xx-pll.c
+++ b/drivers/clk/sophgo/clk-cv18xx-pll.c
@@ -327,7 +327,8 @@ static int fpll_find_rate(struct cv1800_clk_pll *pll,
static int fpll_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
{
struct cv1800_clk_pll *pll = hw_to_cv1800_clk_pll(hw);
- u32 val, ssc_syn_set;
+ u32 val = 0;
+ u32 ssc_syn_set = 0;
if (!fpll_is_factional_mode(pll))
return ipll_determine_rate(hw, req);
fpll_find_rate(pll, &pll->pll_limit[2], req->best_parent_rate,
&req->rate, &val, &ssc_syn_set);
static int fpll_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
{
struct cv1800_clk_pll *pll = hw_to_cv1800_clk_pll(hw);
- u32 val, ssc_syn_set;
+ u32 val = 0;
+ u32 ssc_syn_set = 0;
if (!fpll_is_factional_mode(pll))
return ipll_determine_rate(hw, req);
fpll_find_rate(pll, &pll->pll_limit[2], req->best_parent_rate,
&req->rate, &val, &ssc_syn_set);
////
Here, I am assuming that the default value for u32 is 0, if not please let me know what it should be or how it is determined.
I know if it is of type pointer, its value should be NULL.
Another example I saw was like below, where the enum was initialized which I am assuming to be is based on context.
////
diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c
index 24432bd78a5a39..d52f26d1ffbab1 100644
--- a/drivers/cpufreq/amd-pstate-ut.c
+++ b/drivers/cpufreq/amd-pstate-ut.c
index 24432bd78a5a39..d52f26d1ffbab1 100644
--- a/drivers/cpufreq/amd-pstate-ut.c
+++ b/drivers/cpufreq/amd-pstate-ut.c
@@ -267,7 +267,7 @@ static int amd_pstate_set_mode(enum amd_pstate_mode mode)
static void amd_pstate_ut_check_driver(u32 index)
{
- enum amd_pstate_mode mode1, mode2;
+ enum amd_pstate_mode mode1, mode2 = AMD_PSTATE_DISABLE;
int ret;
////
--
Thanks & regards,
Ragavendra BN
Ragavendra BN
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies