From: Julia Lawall <hidden> Date: 2010-10-02 13:55:09
This code does not call deinit_card(card); in an error case, as done in
other error-handling code in the same function. But actually, the called
function init_sram can only return 0, so there is no need for the error
check at all.
A simplified version of the sematic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r exists@
@r@
statement S1,S2,S3;
constant C1,C2,C3;
@@
*if (...)
{... S1 return -C1;}
...
*if (...)
{... when != S1
return -C2;}
...
*if (...)
{... S1 return -C3;}
// </smpl>
Signed-off-by: Julia Lawall <redacted>
---
drivers/atm/idt77252.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -3410,8 +3410,7 @@ init_card(struct atm_dev *dev)writel(readl(SAR_REG_CFG)|conf,SAR_REG_CFG);-if(init_sram(card)<0)-return-1;+init_sram(card);/********************************************************************//* A L L O C R A M A N D S E T V A R I O U S T H I N G S */
From: walter harms <hidden> Date: 2010-10-02 14:09:47
Julia Lawall schrieb:
This code does not call deinit_card(card); in an error case, as done in
other error-handling code in the same function. But actually, the called
function init_sram can only return 0, so there is no need for the error
check at all.
did you set init_sram() to void ?
re,
wh
quoted hunk
A simplified version of the sematic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r exists@
@r@
statement S1,S2,S3;
constant C1,C2,C3;
@@
*if (...)
{... S1 return -C1;}
...
*if (...)
{... when != S1
return -C2;}
...
*if (...)
{... S1 return -C3;}
// </smpl>
Signed-off-by: Julia Lawall <redacted>
---
drivers/atm/idt77252.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -3410,8 +3410,7 @@ init_card(struct atm_dev *dev)writel(readl(SAR_REG_CFG)|conf,SAR_REG_CFG);-if(init_sram(card)<0)-return-1;+init_sram(card);/********************************************************************//* A L L O C R A M A N D S E T V A R I O U S T H I N G S */--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Julia Lawall <hidden> Date: 2010-10-02 14:21:27
On Sat, 2 Oct 2010, walter harms wrote:
Julia Lawall schrieb:
quoted
This code does not call deinit_card(card); in an error case, as done in
other error-handling code in the same function. But actually, the called
function init_sram can only return 0, so there is no need for the error
check at all.
did you set init_sram() to void ?
No, that indeed seems like a reasonable change. Patch shortly.
julia
From: Julia Lawall <hidden> Date: 2010-10-02 14:37:12
This code does not call deinit_card(card); in an error case, as done in
other error-handling code in the same function. But actually, the called
function init_sram can only return 0, so there is no need for the error
check at all.
init_sram is also given a void return type, and its single return statement
at the end of the function is dropped.
A simplified version of the sematic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r exists@
@r@
statement S1,S2,S3;
constant C1,C2,C3;
@@
*if (...)
{... S1 return -C1;}
...
*if (...)
{... when != S1
return -C2;}
...
*if (...)
{... S1 return -C3;}
// </smpl>
Signed-off-by: Julia Lawall <redacted>
---
drivers/atm/idt77252.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
@@ -3410,8 +3409,7 @@ init_card(struct atm_dev *dev)writel(readl(SAR_REG_CFG)|conf,SAR_REG_CFG);-if(init_sram(card)<0)-return-1;+init_sram(card);/********************************************************************//* A L L O C R A M A N D S E T V A R I O U S T H I N G S */
From: David Miller <davem@davemloft.net> Date: 2010-10-04 05:06:07
From: Julia Lawall <redacted>
Date: Sat, 2 Oct 2010 16:37:07 +0200 (CEST)
This code does not call deinit_card(card); in an error case, as done in
other error-handling code in the same function. But actually, the called
function init_sram can only return 0, so there is no need for the error
check at all.
init_sram is also given a void return type, and its single return statement
at the end of the function is dropped.
A simplified version of the sematic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)