All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
@ 2014-05-19  4:47 ` Julia Lawall
  0 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2014-05-19  4:47 UTC (permalink / raw)
  To: qla2xxx-upstream
  Cc: kernel-janitors, James E.J. Bottomley, linux-scsi, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Delete unnecessary use of a local variable to immediately return 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
Changed subject line, which was not appreciated by some spam filters.

 drivers/scsi/qla2xxx/qla_init.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 38aeb54..a63f9b6 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4593,8 +4593,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
 		if (unlikely(pci_channel_offline(ha->pdev) &&
 		    ha->flags.pci_channel_io_perm_failure)) {
 			clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
-			status = 0;
-			return status;
+			return 0;
 		}
 
 		ha->isp_ops->get_flash_version(vha, req->ring);


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
@ 2014-05-19  4:47 ` Julia Lawall
  0 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2014-05-19  4:47 UTC (permalink / raw)
  To: qla2xxx-upstream
  Cc: kernel-janitors, James E.J. Bottomley, linux-scsi, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Delete unnecessary use of a local variable to immediately return 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
Changed subject line, which was not appreciated by some spam filters.

 drivers/scsi/qla2xxx/qla_init.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 38aeb54..a63f9b6 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4593,8 +4593,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
 		if (unlikely(pci_channel_offline(ha->pdev) &&
 		    ha->flags.pci_channel_io_perm_failure)) {
 			clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
-			status = 0;
-			return status;
+			return 0;
 		}
 
 		ha->isp_ops->get_flash_version(vha, req->ring);


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
  2014-05-19  4:47 ` Julia Lawall
  (?)
@ 2014-05-19 16:07   ` Saurav Kashyap
  -1 siblings, 0 replies; 13+ messages in thread
From: Saurav Kashyap @ 2014-05-19 16:07 UTC (permalink / raw)
  To: Julia Lawall, Dept-Eng QLA2xxx Upstream
  Cc: kernel-janitors, James E.J. Bottomley, linux-scsi, linux-kernel

Hi Julia,

Status is already set to 0 at the beginning of the function, I think
we should just "return status" here to be consistent with the rest of
the function.

==========
diff --git a/drivers/scsi/qla2xxx/qla_init.c
b/drivers/scsi/qla2xxx/qla_init.c
index 76af6b6..e339833 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4587,7 +4587,6 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
                if (unlikely(pci_channel_offline(ha->pdev) &&
                    ha->flags.pci_channel_io_perm_failure)) {
                        clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
-                       status = 0;
                        return status;
                }
=========

Thanks,
~Saurav
 




>From: Julia Lawall <Julia.Lawall@lip6.fr>
>
>Delete unnecessary use of a local variable to immediately return 0.
>
>A simplified version of the semantic patch that fixes this problem is as
>follows: (http://coccinelle.lip6.fr/)
>
>// <smpl>
>@r exists@
>local idexpression ret;
>expression e;
>position p;
>@@
>
>-ret = 0;
>... when != ret = e
>return 
>- ret
>+ 0
>  ;
>// </smpl>
>
>Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
>---
>Changed subject line, which was not appreciated by some spam filters.
>
> drivers/scsi/qla2xxx/qla_init.c |    3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/drivers/scsi/qla2xxx/qla_init.c
>b/drivers/scsi/qla2xxx/qla_init.c
>index 38aeb54..a63f9b6 100644
>--- a/drivers/scsi/qla2xxx/qla_init.c
>+++ b/drivers/scsi/qla2xxx/qla_init.c
>@@ -4593,8 +4593,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
> 		if (unlikely(pci_channel_offline(ha->pdev) &&
> 		    ha->flags.pci_channel_io_perm_failure)) {
> 			clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
>-			status = 0;
>-			return status;
>+			return 0;
> 		}
> 
> 		ha->isp_ops->get_flash_version(vha, req->ring);


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
@ 2014-05-19 16:07   ` Saurav Kashyap
  0 siblings, 0 replies; 13+ messages in thread
From: Saurav Kashyap @ 2014-05-19 16:07 UTC (permalink / raw)
  To: Julia Lawall, Dept-Eng QLA2xxx Upstream
  Cc: kernel-janitors, James E.J. Bottomley, linux-scsi, linux-kernel

Hi Julia,

Status is already set to 0 at the beginning of the function, I think
we should just "return status" here to be consistent with the rest of
the function.

=====
diff --git a/drivers/scsi/qla2xxx/qla_init.c
b/drivers/scsi/qla2xxx/qla_init.c
index 76af6b6..e339833 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4587,7 +4587,6 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
                if (unlikely(pci_channel_offline(ha->pdev) &&
                    ha->flags.pci_channel_io_perm_failure)) {
                        clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
-                       status = 0;
                        return status;
                }
====
Thanks,
~Saurav
 




>From: Julia Lawall <Julia.Lawall@lip6.fr>
>
>Delete unnecessary use of a local variable to immediately return 0.
>
>A simplified version of the semantic patch that fixes this problem is as
>follows: (http://coccinelle.lip6.fr/)
>
>// <smpl>
>@r exists@
>local idexpression ret;
>expression e;
>position p;
>@@
>
>-ret = 0;
>... when != ret = e
>return 
>- ret
>+ 0
>  ;
>// </smpl>
>
>Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
>---
>Changed subject line, which was not appreciated by some spam filters.
>
> drivers/scsi/qla2xxx/qla_init.c |    3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/drivers/scsi/qla2xxx/qla_init.c
>b/drivers/scsi/qla2xxx/qla_init.c
>index 38aeb54..a63f9b6 100644
>--- a/drivers/scsi/qla2xxx/qla_init.c
>+++ b/drivers/scsi/qla2xxx/qla_init.c
>@@ -4593,8 +4593,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
> 		if (unlikely(pci_channel_offline(ha->pdev) &&
> 		    ha->flags.pci_channel_io_perm_failure)) {
> 			clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
>-			status = 0;
>-			return status;
>+			return 0;
> 		}
> 
> 		ha->isp_ops->get_flash_version(vha, req->ring);


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
@ 2014-05-19 16:07   ` Saurav Kashyap
  0 siblings, 0 replies; 13+ messages in thread
From: Saurav Kashyap @ 2014-05-19 16:07 UTC (permalink / raw)
  To: Julia Lawall, Dept-Eng QLA2xxx Upstream
  Cc: kernel-janitors, James E.J. Bottomley, linux-scsi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]

Hi Julia,

Status is already set to 0 at the beginning of the function, I think
we should just "return status" here to be consistent with the rest of
the function.

==========
diff --git a/drivers/scsi/qla2xxx/qla_init.c
b/drivers/scsi/qla2xxx/qla_init.c
index 76af6b6..e339833 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4587,7 +4587,6 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
                if (unlikely(pci_channel_offline(ha->pdev) &&
                    ha->flags.pci_channel_io_perm_failure)) {
                        clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
-                       status = 0;
                        return status;
                }
=========

Thanks,
~Saurav
 




>From: Julia Lawall <Julia.Lawall@lip6.fr>
>
>Delete unnecessary use of a local variable to immediately return 0.
>
>A simplified version of the semantic patch that fixes this problem is as
>follows: (http://coccinelle.lip6.fr/)
>
>// <smpl>
>@r exists@
>local idexpression ret;
>expression e;
>position p;
>@@
>
>-ret = 0;
>... when != ret = e
>return 
>- ret
>+ 0
>  ;
>// </smpl>
>
>Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
>---
>Changed subject line, which was not appreciated by some spam filters.
>
> drivers/scsi/qla2xxx/qla_init.c |    3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/drivers/scsi/qla2xxx/qla_init.c
>b/drivers/scsi/qla2xxx/qla_init.c
>index 38aeb54..a63f9b6 100644
>--- a/drivers/scsi/qla2xxx/qla_init.c
>+++ b/drivers/scsi/qla2xxx/qla_init.c
>@@ -4593,8 +4593,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
> 		if (unlikely(pci_channel_offline(ha->pdev) &&
> 		    ha->flags.pci_channel_io_perm_failure)) {
> 			clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
>-			status = 0;
>-			return status;
>+			return 0;
> 		}
> 
> 		ha->isp_ops->get_flash_version(vha, req->ring);


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 4826 bytes --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
  2014-05-19 16:07   ` Saurav Kashyap
@ 2014-05-19 20:12     ` Dan Carpenter
  -1 siblings, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2014-05-19 20:12 UTC (permalink / raw)
  To: Saurav Kashyap
  Cc: Julia Lawall, Dept-Eng QLA2xxx Upstream, kernel-janitors,
	James E.J. Bottomley, linux-scsi, linux-kernel

On Mon, May 19, 2014 at 04:07:52PM +0000, Saurav Kashyap wrote:
> Hi Julia,
> 
> Status is already set to 0 at the beginning of the function, I think
> we should just "return status" here to be consistent with the rest of
> the function.

"return 0;" is more clear than "return status;".

Consistency is great so long as it makes the code easier to read.  Don't
lose track of the real goal.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
@ 2014-05-19 20:12     ` Dan Carpenter
  0 siblings, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2014-05-19 20:12 UTC (permalink / raw)
  To: Saurav Kashyap
  Cc: Julia Lawall, Dept-Eng QLA2xxx Upstream, kernel-janitors,
	James E.J. Bottomley, linux-scsi, linux-kernel

On Mon, May 19, 2014 at 04:07:52PM +0000, Saurav Kashyap wrote:
> Hi Julia,
> 
> Status is already set to 0 at the beginning of the function, I think
> we should just "return status" here to be consistent with the rest of
> the function.

"return 0;" is more clear than "return status;".

Consistency is great so long as it makes the code easier to read.  Don't
lose track of the real goal.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
  2014-05-19 20:12     ` Dan Carpenter
@ 2014-05-19 23:36       ` Julia Lawall
  -1 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2014-05-19 23:36 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Saurav Kashyap, Dept-Eng QLA2xxx Upstream, kernel-janitors,
	James E.J. Bottomley, linux-scsi, linux-kernel



On Mon, 19 May 2014, Dan Carpenter wrote:

> On Mon, May 19, 2014 at 04:07:52PM +0000, Saurav Kashyap wrote:
> > Hi Julia,
> >
> > Status is already set to 0 at the beginning of the function, I think
> > we should just "return status" here to be consistent with the rest of
> > the function.
>
> "return 0;" is more clear than "return status;".
>
> Consistency is great so long as it makes the code easier to read.  Don't
> lose track of the real goal.

If status were an informative word, there might be a reason for it.  But
integer typed functions almost always return their status, so there is no
real information.

julia

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
@ 2014-05-19 23:36       ` Julia Lawall
  0 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2014-05-19 23:36 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Saurav Kashyap, Dept-Eng QLA2xxx Upstream, kernel-janitors,
	James E.J. Bottomley, linux-scsi, linux-kernel



On Mon, 19 May 2014, Dan Carpenter wrote:

> On Mon, May 19, 2014 at 04:07:52PM +0000, Saurav Kashyap wrote:
> > Hi Julia,
> >
> > Status is already set to 0 at the beginning of the function, I think
> > we should just "return status" here to be consistent with the rest of
> > the function.
>
> "return 0;" is more clear than "return status;".
>
> Consistency is great so long as it makes the code easier to read.  Don't
> lose track of the real goal.

If status were an informative word, there might be a reason for it.  But
integer typed functions almost always return their status, so there is no
real information.

julia

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
  2014-05-19 23:36       ` Julia Lawall
@ 2014-05-19 23:46         ` Dan Carpenter
  -1 siblings, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2014-05-19 23:46 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Saurav Kashyap, Dept-Eng QLA2xxx Upstream, kernel-janitors,
	James E.J. Bottomley, linux-scsi, linux-kernel

On Tue, May 20, 2014 at 07:36:48AM +0800, Julia Lawall wrote:
> 
> 
> On Mon, 19 May 2014, Dan Carpenter wrote:
> 
> > On Mon, May 19, 2014 at 04:07:52PM +0000, Saurav Kashyap wrote:
> > > Hi Julia,
> > >
> > > Status is already set to 0 at the beginning of the function, I think
> > > we should just "return status" here to be consistent with the rest of
> > > the function.
> >
> > "return 0;" is more clear than "return status;".
> >
> > Consistency is great so long as it makes the code easier to read.  Don't
> > lose track of the real goal.
> 
> If status were an informative word, there might be a reason for it.  But
> integer typed functions almost always return their status, so there is no
> real information.

Just to be clear, I'm agreeing with you...  "return 0;" is better.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
@ 2014-05-19 23:46         ` Dan Carpenter
  0 siblings, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2014-05-19 23:46 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Saurav Kashyap, Dept-Eng QLA2xxx Upstream, kernel-janitors,
	James E.J. Bottomley, linux-scsi, linux-kernel

On Tue, May 20, 2014 at 07:36:48AM +0800, Julia Lawall wrote:
> 
> 
> On Mon, 19 May 2014, Dan Carpenter wrote:
> 
> > On Mon, May 19, 2014 at 04:07:52PM +0000, Saurav Kashyap wrote:
> > > Hi Julia,
> > >
> > > Status is already set to 0 at the beginning of the function, I think
> > > we should just "return status" here to be consistent with the rest of
> > > the function.
> >
> > "return 0;" is more clear than "return status;".
> >
> > Consistency is great so long as it makes the code easier to read.  Don't
> > lose track of the real goal.
> 
> If status were an informative word, there might be a reason for it.  But
> integer typed functions almost always return their status, so there is no
> real information.

Just to be clear, I'm agreeing with you...  "return 0;" is better.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
  2014-05-19 23:46         ` Dan Carpenter
@ 2014-05-20 15:07           ` Saurav Kashyap
  -1 siblings, 0 replies; 13+ messages in thread
From: Saurav Kashyap @ 2014-05-20 15:07 UTC (permalink / raw)
  To: Dan Carpenter, Julia Lawall
  Cc: Dept-Eng QLA2xxx Upstream, kernel-janitors, James E.J. Bottomley,
	linux-scsi, linux-kernel

Acked-by: Saurav Kashyap <saurav.kashyap@qlogic.com>

>On Tue, May 20, 2014 at 07:36:48AM +0800, Julia Lawall wrote:
>> 
>> 
>> On Mon, 19 May 2014, Dan Carpenter wrote:
>> 
>> > On Mon, May 19, 2014 at 04:07:52PM +0000, Saurav Kashyap wrote:
>> > > Hi Julia,
>> > >
>> > > Status is already set to 0 at the beginning of the function, I think
>> > > we should just "return status" here to be consistent with the rest
>>of
>> > > the function.
>> >
>> > "return 0;" is more clear than "return status;".
>> >
>> > Consistency is great so long as it makes the code easier to read.
>>Don't
>> > lose track of the real goal.
>> 
>> If status were an informative word, there might be a reason for it.  But
>> integer typed functions almost always return their status, so there is
>>no
>> real information.
>
>Just to be clear, I'm agreeing with you...  "return 0;" is better.
>
>regards,
>dan carpenter
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit
@ 2014-05-20 15:07           ` Saurav Kashyap
  0 siblings, 0 replies; 13+ messages in thread
From: Saurav Kashyap @ 2014-05-20 15:07 UTC (permalink / raw)
  To: Dan Carpenter, Julia Lawall
  Cc: Dept-Eng QLA2xxx Upstream, kernel-janitors, James E.J. Bottomley,
	linux-scsi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 932 bytes --]

Acked-by: Saurav Kashyap <saurav.kashyap@qlogic.com>

>On Tue, May 20, 2014 at 07:36:48AM +0800, Julia Lawall wrote:
>> 
>> 
>> On Mon, 19 May 2014, Dan Carpenter wrote:
>> 
>> > On Mon, May 19, 2014 at 04:07:52PM +0000, Saurav Kashyap wrote:
>> > > Hi Julia,
>> > >
>> > > Status is already set to 0 at the beginning of the function, I think
>> > > we should just "return status" here to be consistent with the rest
>>of
>> > > the function.
>> >
>> > "return 0;" is more clear than "return status;".
>> >
>> > Consistency is great so long as it makes the code easier to read.
>>Don't
>> > lose track of the real goal.
>> 
>> If status were an informative word, there might be a reason for it.  But
>> integer typed functions almost always return their status, so there is
>>no
>> real information.
>
>Just to be clear, I'm agreeing with you...  "return 0;" is better.
>
>regards,
>dan carpenter
>


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 4554 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-05-20 15:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-19  4:47 [PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit Julia Lawall
2014-05-19  4:47 ` Julia Lawall
2014-05-19 16:07 ` Saurav Kashyap
2014-05-19 16:07   ` Saurav Kashyap
2014-05-19 16:07   ` Saurav Kashyap
2014-05-19 20:12   ` Dan Carpenter
2014-05-19 20:12     ` Dan Carpenter
2014-05-19 23:36     ` Julia Lawall
2014-05-19 23:36       ` Julia Lawall
2014-05-19 23:46       ` Dan Carpenter
2014-05-19 23:46         ` Dan Carpenter
2014-05-20 15:07         ` Saurav Kashyap
2014-05-20 15:07           ` Saurav Kashyap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.