Staging: sm750fb: Remove an unnecessary local variable in a function
Subsystems (2)
PATCH 1/1 Staging: sm750fb: Remove an unnecessary local variable in a function
Remove an unnecessary local variable in sm750_format_pll_reg function and replace its initialization directly in return type. Issue suggested by Coccinelle using ret.cocci.
--- drivers/staging/sm750fb/ddk750_chip.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +1 -4
@@ -391,7 +391,6 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)unsigned int OD = pPLL->OD;unsigned int M = pPLL->M;unsigned int N = pPLL->N; -unsigned int reg =0 ;/* * Note that all PLL's have the same format. Here, we just use
@@ -399,13 +398,11 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)* register. On returning a 32 bit number, the value can be * applied to any PLL in the calling function. */ - reg =PLL_CTRL_POWER | +return PLL_CTRL_POWER | #ifndef VALIDATION_CHIP ((POD <<PLL_CTRL_POD_SHIFT ) &PLL_CTRL_POD_MASK ) | #endif ((OD <<PLL_CTRL_OD_SHIFT ) &PLL_CTRL_OD_MASK ) | ((N <<PLL_CTRL_N_SHIFT ) &PLL_CTRL_N_MASK ) | ((M <<PLL_CTRL_M_SHIFT ) &PLL_CTRL_M_MASK ); - -return reg; }
Signature · 1 line
2.17.1
Quoted 25 lines · Madhumitha Prabakaran
Remove an unnecessary local variable in
sm750_format_pll_regfunction and replace its initialization directly in return type. Issue suggested by Coccinelle usingret.cocci.Signed-off-by Madhumitha Prabakaran <[email protected]>--- drivers/staging/sm750fb/ddk750_chip.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/sm750fb/ddk750_chip.c +0
-1@@ -391,7 +391,6 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)unsigned int OD = pPLL->OD;unsigned int M = pPLL->M;unsigned int N = pPLL->N; -unsigned int reg =0 ;/* * Note that all PLL's have the same format. Here, we just use @@ -399,13 +398,11 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)* register. On returning a 32 bit number, the value can be * applied to any PLL in the calling function. */
drivers/staging/sm750fb/ddk750_chip.c unsigned int sm750_format_pll_reg(struct pll_value *pPLL) · line 410
Quoted 10 lines
drivers/staging/sm750fb/ddk750_chip.c +1
-3- reg =PLL_CTRL_POWER | +return PLL_CTRL_POWER | #ifndef VALIDATION_CHIP ((POD <<PLL_CTRL_POD_SHIFT ) &PLL_CTRL_POD_MASK ) | #endif ((OD <<PLL_CTRL_OD_SHIFT ) &PLL_CTRL_OD_MASK ) | ((N <<PLL_CTRL_N_SHIFT ) &PLL_CTRL_N_MASK ) | ((M <<PLL_CTRL_M_SHIFT ) &PLL_CTRL_M_MASK ); - -return reg;
This is going better in the right direction. But maybe it is less readable than before, with that very large expression and the ifndef...
julia
Quoted 11 lines
drivers/staging/sm750fb/ddk750_chip.c +0
-1} --2.17.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190313153205.4974-1-madhumithabiw%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 49 lines · Julia Lawall
Quoted 25 lines · Madhumitha Prabakaran
Remove an unnecessary local variable in
sm750_format_pll_regfunction and replace its initialization directly in return type. Issue suggested by Coccinelle usingret.cocci.Signed-off-by Madhumitha Prabakaran <[email protected]>--- drivers/staging/sm750fb/ddk750_chip.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/sm750fb/ddk750_chip.c +0
-1@@ -391,7 +391,6 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)unsigned int OD = pPLL->OD;unsigned int M = pPLL->M;unsigned int N = pPLL->N; -unsigned int reg =0 ;/* * Note that all PLL's have the same format. Here, we just use @@ -399,13 +398,11 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)* register. On returning a 32 bit number, the value can be * applied to any PLL in the calling function. */ drivers/staging/sm750fb/ddk750_chip.c unsigned int sm750_format_pll_reg(struct pll_value *pPLL) · line 410
Quoted 10 lines
drivers/staging/sm750fb/ddk750_chip.c +1
-3- reg =PLL_CTRL_POWER | +return PLL_CTRL_POWER | #ifndef VALIDATION_CHIP ((POD <<PLL_CTRL_POD_SHIFT ) &PLL_CTRL_POD_MASK ) | #endif ((OD <<PLL_CTRL_OD_SHIFT ) &PLL_CTRL_OD_MASK ) | ((N <<PLL_CTRL_N_SHIFT ) &PLL_CTRL_N_MASK ) | ((M <<PLL_CTRL_M_SHIFT ) &PLL_CTRL_M_MASK ); - -return reg;This is going better in the right direction. But maybe it is less readable than before, with that very large expression and the ifndef...
julia
Quoted 4 lines
drivers/staging/sm750fb/ddk750_chip.c +0
-1} --2.17.1
Quoted 14 lines
Quoted 7 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190313153205.4974-1-madhumithabiw%40gmail.com.
For more options, visit https://groups.google.com/d/optout.Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1903131634500.27312%40hadrien. For more options, visit https://groups.google.com/d/optout.
Do you want me to drop this? As the previous code is more readable than this one.
thanks,
Madhumitha
Quoted 58 lines · Madhumthia Prabakaran
Quoted 57 lines · Julia Lawall
Quoted 25 lines · Madhumitha Prabakaran
Remove an unnecessary local variable in
sm750_format_pll_regfunction and replace its initialization directly in return type. Issue suggested by Coccinelle usingret.cocci.Signed-off-by Madhumitha Prabakaran <[email protected]>--- drivers/staging/sm750fb/ddk750_chip.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/sm750fb/ddk750_chip.c +0
-1@@ -391,7 +391,6 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)unsigned int OD = pPLL->OD;unsigned int M = pPLL->M;unsigned int N = pPLL->N; -unsigned int reg =0 ;/* * Note that all PLL's have the same format. Here, we just use @@ -399,13 +398,11 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)* register. On returning a 32 bit number, the value can be * applied to any PLL in the calling function. */ drivers/staging/sm750fb/ddk750_chip.c unsigned int sm750_format_pll_reg(struct pll_value *pPLL) · line 410
Quoted 10 lines
drivers/staging/sm750fb/ddk750_chip.c +1
-3- reg =PLL_CTRL_POWER | +return PLL_CTRL_POWER | #ifndef VALIDATION_CHIP ((POD <<PLL_CTRL_POD_SHIFT ) &PLL_CTRL_POD_MASK ) | #endif ((OD <<PLL_CTRL_OD_SHIFT ) &PLL_CTRL_OD_MASK ) | ((N <<PLL_CTRL_N_SHIFT ) &PLL_CTRL_N_MASK ) | ((M <<PLL_CTRL_M_SHIFT ) &PLL_CTRL_M_MASK ); - -return reg;This is going better in the right direction. But maybe it is less readable than before, with that very large expression and the ifndef...
julia
Quoted 11 lines
drivers/staging/sm750fb/ddk750_chip.c +0
-1} --2.17.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190313153205.4974-1-madhumithabiw%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 8 lines
Quoted 6 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1903131634500.27312%40hadrien.
For more options, visit https://groups.google.com/d/optout.Do you want me to drop this? As the previous code is more readable than this one.
I don't know. Greg decides...
julia