linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/9] drivers/scsi: Eliminate useless code
@ 2010-01-16 15:58 Julia Lawall
  2010-01-22  0:16 ` Jing Huang
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2010-01-16 15:58 UTC (permalink / raw)
  To: Jing Huang, James E.J. Bottomley, linux-scsi, linux-kernel,
	kernel-janitors

From: Julia Lawall <julia@diku.dk>

The variable bfa_itnim is initialized twice to the same (side effect-free)
expression.  Drop one initialization.

A simplified version of the semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)

// <smpl>
@forall@
idexpression *x;
identifier f!=ERR_PTR;
@@

x = f(...)
... when != x
(
x = f(...,<+...x...+>,...)
|
* x = f(...)
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/scsi/bfa/bfad_im.c          |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index f788c2a..37b0fa1 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -243,9 +243,8 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd,
 	struct bfa_itnim_s *bfa_itnim;
 	bfa_status_t    rc = BFA_STATUS_OK;
 
-	bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim);
 	tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd);
 	if (!tskim) {
 		BFA_DEV_PRINTF(bfad, BFA_ERR,

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

* RE: [PATCH 5/9] drivers/scsi: Eliminate useless code
  2010-01-16 15:58 [PATCH 5/9] drivers/scsi: Eliminate useless code Julia Lawall
@ 2010-01-22  0:16 ` Jing Huang
  0 siblings, 0 replies; 2+ messages in thread
From: Jing Huang @ 2010-01-22  0:16 UTC (permalink / raw)
  To: Julia Lawall, James E.J. Bottomley, linux-scsi, linux-kernel,
	kernel-janitors

Acked-by: Jing Huang <huangj@brocade.com>

> -----Original Message-----
> From: Julia Lawall [mailto:julia@diku.dk]
> Sent: Saturday, January 16, 2010 7:59 AM
> To: Jing Huang; James E.J. Bottomley; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [PATCH 5/9] drivers/scsi: Eliminate useless code
> 
> From: Julia Lawall <julia@diku.dk>
> 
> The variable bfa_itnim is initialized twice to the same (side effect-free)
> expression.  Drop one initialization.
> 
> A simplified version of the semantic match that finds this problem is:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @forall@
> idexpression *x;
> identifier f!=ERR_PTR;
> @@
> 
> x = f(...)
> ... when != x
> (
> x = f(...,<+...x...+>,...)
> |
> * x = f(...)
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
>  drivers/scsi/bfa/bfad_im.c          |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
> index f788c2a..37b0fa1 100644
> --- a/drivers/scsi/bfa/bfad_im.c
> +++ b/drivers/scsi/bfa/bfad_im.c
> @@ -243,9 +243,8 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct
> scsi_cmnd *cmnd,
>  	struct bfa_itnim_s *bfa_itnim;
>  	bfa_status_t    rc = BFA_STATUS_OK;
> 
> -	bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim);
>  	tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd);
>  	if (!tskim) {
>  		BFA_DEV_PRINTF(bfad, BFA_ERR,

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

end of thread, other threads:[~2010-01-22  0:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-16 15:58 [PATCH 5/9] drivers/scsi: Eliminate useless code Julia Lawall
2010-01-22  0:16 ` Jing Huang

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