Kernel contribution

Ragavendra ragavendra.bn at gmail.com
Tue Nov 12 14:27:42 EST 2024


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);

////

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
<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/cpufreq/amd-pstate-ut.c?id=3e39e68dfbb6d4fe8c1943003d2f2a6f3255c902>
+++ b/drivers/cpufreq/amd-pstate-ut.c
<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/cpufreq/amd-pstate-ut.c?id=93497752dfed196b41d2804503e80b9a04318adb>
@@ -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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20241112/ccc006fd/attachment.html>


More information about the Kernelnewbies mailing list