* [PATCH 16/16] drivers/net/qlcnic: Use available error codes
@ 2010-08-16 16:29 Julia Lawall
2010-08-16 18:35 ` Dan Carpenter
2010-08-18 21:28 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2010-08-16 16:29 UTC (permalink / raw)
To: Amit Kumar Salecha, Anirban Chakraborty, linux-driver, netdev,
linux-kernel, kern
From: Julia Lawall <julia@diku.dk>
The error code is stored in the variable err, but it is the variable ret
that is returned instead. So store the error code in ret. Err is then
useless.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
local idexpression x;
constant C;
@@
if (...) { ...
x = -C
... when != x
(
return <+...x...+>;
|
return NULL;
|
return;
|
* return ...;
)
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
This changes the semantics and has not been tested.
drivers/net/qlcnic/qlcnic_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index b9615bd..142ab1d 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -474,7 +474,7 @@ static int
qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
{
struct qlcnic_pci_info pci_info[QLCNIC_MAX_PCI_FUNC];
- int i, ret = 0, err;
+ int i, ret = 0;
u8 pfn;
if (!adapter->npars)
@@ -487,7 +487,7 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL);
if (!adapter->eswitch) {
- err = -ENOMEM;
+ ret = -ENOMEM;
goto err_eswitch;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 16/16] drivers/net/qlcnic: Use available error codes
2010-08-16 16:29 [PATCH 16/16] drivers/net/qlcnic: Use available error codes Julia Lawall
@ 2010-08-16 18:35 ` Dan Carpenter
2010-08-16 19:05 ` Julia Lawall
2010-08-16 20:23 ` Julia Lawall
2010-08-18 21:28 ` David Miller
1 sibling, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2010-08-16 18:35 UTC (permalink / raw)
To: Julia Lawall
Cc: Amit Kumar Salecha, Anirban Chakraborty, linux-driver, netdev,
linux-kernel, kernel-janitors
On Mon, Aug 16, 2010 at 06:29:13PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> The error code is stored in the variable err, but it is the variable ret
> that is returned instead. So store the error code in ret. Err is then
> useless.
Could you redo this for the latest git? (Sorry, I recently made the
problem slightly worse by adding another "err = -ENOMEM;")...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 16/16] drivers/net/qlcnic: Use available error codes
2010-08-16 18:35 ` Dan Carpenter
@ 2010-08-16 19:05 ` Julia Lawall
2010-08-16 20:23 ` Julia Lawall
1 sibling, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2010-08-16 19:05 UTC (permalink / raw)
To: Dan Carpenter
Cc: Amit Kumar Salecha, Anirban Chakraborty, linux-driver, netdev,
linux-kernel, kernel-janitors
On Mon, 16 Aug 2010, Dan Carpenter wrote:
> On Mon, Aug 16, 2010 at 06:29:13PM +0200, Julia Lawall wrote:
> > From: Julia Lawall <julia@diku.dk>
> >
> > The error code is stored in the variable err, but it is the variable ret
> > that is returned instead. So store the error code in ret. Err is then
> > useless.
>
> Could you redo this for the latest git? (Sorry, I recently made the
> problem slightly worse by adding another "err = -ENOMEM;")...
Sure. I'll send it shortly.
julia
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 16/16] drivers/net/qlcnic: Use available error codes
2010-08-16 18:35 ` Dan Carpenter
2010-08-16 19:05 ` Julia Lawall
@ 2010-08-16 20:23 ` Julia Lawall
1 sibling, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2010-08-16 20:23 UTC (permalink / raw)
To: Dan Carpenter
Cc: Amit Kumar Salecha, Anirban Chakraborty, linux-driver, netdev,
linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
The error code is stored in the variable err, but it is the variable ret
that is returned instead. So store the error code in ret. Err is then
useless.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
local idexpression x;
constant C;
@@
if (...) { ...
x = -C
... when != x
(
return <+...x...+>;
|
return NULL;
|
return;
|
* return ...;
)
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
This changes the semantics and has not been tested.
This version is based on a more recent version of the file than the
previous version.
drivers/net/qlcnic/qlcnic_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index bf6d87a..81d9d75 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -474,7 +474,7 @@ static int
qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
{
struct qlcnic_pci_info *pci_info;
- int i, ret = 0, err;
+ int i, ret = 0;
u8 pfn;
pci_info = kcalloc(QLCNIC_MAX_PCI_FUNC, sizeof(*pci_info), GFP_KERNEL);
@@ -484,14 +484,14 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) *
QLCNIC_MAX_PCI_FUNC, GFP_KERNEL);
if (!adapter->npars) {
- err = -ENOMEM;
+ ret = -ENOMEM;
goto err_pci_info;
}
adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL);
if (!adapter->eswitch) {
- err = -ENOMEM;
+ ret = -ENOMEM;
goto err_npars;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 16/16] drivers/net/qlcnic: Use available error codes
2010-08-16 16:29 [PATCH 16/16] drivers/net/qlcnic: Use available error codes Julia Lawall
2010-08-16 18:35 ` Dan Carpenter
@ 2010-08-18 21:28 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2010-08-18 21:28 UTC (permalink / raw)
To: julia
Cc: amit.salecha, anirban.chakraborty, linux-driver, netdev,
linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Date: Mon, 16 Aug 2010 18:29:13 +0200 (CEST)
> From: Julia Lawall <julia@diku.dk>
>
> The error code is stored in the variable err, but it is the variable ret
> that is returned instead. So store the error code in ret. Err is then
> useless.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
...
> Signed-off-by: Julia Lawall <julia@diku.dk>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-08-18 21:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-16 16:29 [PATCH 16/16] drivers/net/qlcnic: Use available error codes Julia Lawall
2010-08-16 18:35 ` Dan Carpenter
2010-08-16 19:05 ` Julia Lawall
2010-08-16 20:23 ` Julia Lawall
2010-08-18 21:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).