kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] remove unneeded array
@ 2014-11-30 18:14 Julia Lawall
  2014-11-30 18:14 ` [PATCH 1/4] target: " Julia Lawall
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Julia Lawall @ 2014-11-30 18:14 UTC (permalink / raw)
  To: devel
  Cc: sparmaintainer, linux-scsi, linux-usb, kernel-janitors,
	linux-kernel, target-devel

Remove an array or structure that only serves as the first argument to
memset.  The complete semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier x;
type T;
@@

{
... when any
-T x[...];
<+... when != x
- memset(x,...);
...+>
}

@@
identifier x,i;
@@

{
... when any
-struct i x;
<+... when != x
- memset(&x,...);
...+>
}
// </smpl>


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

* [PATCH 1/4] target: remove unneeded array
  2014-11-30 18:14 [PATCH 0/4] remove unneeded array Julia Lawall
@ 2014-11-30 18:14 ` Julia Lawall
  2014-12-02  6:12   ` Nicholas A. Bellinger
  2014-11-30 18:14 ` [PATCH 2/4] drivers/scsi/bfa/bfa_svc.c: remove unneeded structure Julia Lawall
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2014-11-30 18:14 UTC (permalink / raw)
  To: Nicholas A. Bellinger
  Cc: kernel-janitors, linux-scsi, target-devel, linux-kernel

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

Delete a local array that is only used to be initialized by memset.

A semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier x;
type T;
@@

{
... when any
-T x[...];
<+... when != x
- memset(x,...);
...+>
}
// </smpl>

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

---
 drivers/target/target_core_pr.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 4c261c3..a0f850b 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -1429,14 +1429,12 @@ core_scsi3_decode_spec_i_port(
 	struct target_core_fabric_ops *tmp_tf_ops;
 	unsigned char *buf;
 	unsigned char *ptr, *i_str = NULL, proto_ident, tmp_proto_ident;
-	char *iport_ptr = NULL, dest_iport[64], i_buf[PR_REG_ISID_ID_LEN];
+	char *iport_ptr = NULL, i_buf[PR_REG_ISID_ID_LEN];
 	sense_reason_t ret;
 	u32 tpdl, tid_len = 0;
 	int dest_local_nexus;
 	u32 dest_rtpi = 0;
 
-	memset(dest_iport, 0, 64);
-
 	local_se_deve = se_sess->se_node_acl->device_list[cmd->orig_fe_lun];
 	/*
 	 * Allocate a struct pr_transport_id_holder and setup the
@@ -3059,7 +3057,7 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
 	struct t10_reservation *pr_tmpl = &dev->t10_pr;
 	unsigned char *buf;
 	unsigned char *initiator_str;
-	char *iport_ptr = NULL, dest_iport[64], i_buf[PR_REG_ISID_ID_LEN];
+	char *iport_ptr = NULL, i_buf[PR_REG_ISID_ID_LEN];
 	u32 tid_len, tmp_tid_len;
 	int new_reg = 0, type, scope, matching_iname;
 	sense_reason_t ret;
@@ -3071,7 +3069,6 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 	}
 
-	memset(dest_iport, 0, 64);
 	memset(i_buf, 0, PR_REG_ISID_ID_LEN);
 	se_tpg = se_sess->se_tpg;
 	tf_ops = se_tpg->se_tpg_tfo;


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

* [PATCH 2/4] drivers/scsi/bfa/bfa_svc.c: remove unneeded structure
  2014-11-30 18:14 [PATCH 0/4] remove unneeded array Julia Lawall
  2014-11-30 18:14 ` [PATCH 1/4] target: " Julia Lawall
@ 2014-11-30 18:14 ` Julia Lawall
  2014-11-30 18:14 ` [PATCH 3/4] staging: unisys: " Julia Lawall
  2014-11-30 18:14 ` [PATCH 4/4] usbip: " Julia Lawall
  3 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2014-11-30 18:14 UTC (permalink / raw)
  To: Anil Gurumurthy
  Cc: kernel-janitors, Sudarsana Kalluru, James E.J. Bottomley,
	linux-scsi, linux-kernel

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

Delete a local structure that is only used to be initialized by memset.

A semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier x,i;
@@

{
... when any
-struct i x;
<+... when != x
- memset(&x,...);
...+>
}
// </smpl>

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

---
 drivers/scsi/bfa/bfa_svc.c |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index 625225f..cf46683 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -404,13 +404,10 @@ bfa_plog_fchdr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
 			enum bfa_plog_eid event,
 			u16 misc, struct fchs_s *fchdr)
 {
-	struct bfa_plog_rec_s  lp;
 	u32	*tmp_int = (u32 *) fchdr;
 	u32	ints[BFA_PL_INT_LOG_SZ];
 
 	if (plog->plog_enabled) {
-		memset(&lp, 0, sizeof(struct bfa_plog_rec_s));
-
 		ints[0] = tmp_int[0];
 		ints[1] = tmp_int[1];
 		ints[2] = tmp_int[4];
@@ -424,13 +421,10 @@ bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
 		      enum bfa_plog_eid event, u16 misc, struct fchs_s *fchdr,
 		      u32 pld_w0)
 {
-	struct bfa_plog_rec_s  lp;
 	u32	*tmp_int = (u32 *) fchdr;
 	u32	ints[BFA_PL_INT_LOG_SZ];
 
 	if (plog->plog_enabled) {
-		memset(&lp, 0, sizeof(struct bfa_plog_rec_s));
-
 		ints[0] = tmp_int[0];
 		ints[1] = tmp_int[1];
 		ints[2] = tmp_int[4];


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

* [PATCH 3/4] staging: unisys: remove unneeded structure
  2014-11-30 18:14 [PATCH 0/4] remove unneeded array Julia Lawall
  2014-11-30 18:14 ` [PATCH 1/4] target: " Julia Lawall
  2014-11-30 18:14 ` [PATCH 2/4] drivers/scsi/bfa/bfa_svc.c: remove unneeded structure Julia Lawall
@ 2014-11-30 18:14 ` Julia Lawall
  2014-11-30 18:14 ` [PATCH 4/4] usbip: " Julia Lawall
  3 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2014-11-30 18:14 UTC (permalink / raw)
  To: Benjamin Romer
  Cc: kernel-janitors, David Kershner, Greg Kroah-Hartman,
	sparmaintainer, devel, linux-kernel

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

Delete a local structure that is only used to be initialized by memset.

A semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier x,i;
@@

{
... when any
-struct i x;
<+... when != x
- memset(&x,...);
...+>
}
// </smpl>

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

---
 drivers/staging/unisys/visorchipset/visorchipset_main.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index c8f7bea..7e6be32 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -1940,7 +1940,6 @@ static HOSTADDRESS controlvm_get_channel_address(void)
 static void
 controlvm_periodic_work(struct work_struct *work)
 {
-	struct visorchipset_channel_info chanInfo;
 	struct controlvm_message inmsg;
 	BOOL gotACommand = FALSE;
 	BOOL handle_command_failed = FALSE;
@@ -1955,8 +1954,6 @@ controlvm_periodic_work(struct work_struct *work)
 	if (visorchipset_clientregwait && !clientregistered)
 		goto Away;
 
-	memset(&chanInfo, 0, sizeof(struct visorchipset_channel_info));
-
 	Poll_Count++;
 	if (Poll_Count >= 250)
 		;	/* keep going */


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

* [PATCH 4/4] usbip: remove unneeded structure
  2014-11-30 18:14 [PATCH 0/4] remove unneeded array Julia Lawall
                   ` (2 preceding siblings ...)
  2014-11-30 18:14 ` [PATCH 3/4] staging: unisys: " Julia Lawall
@ 2014-11-30 18:14 ` Julia Lawall
  2014-12-01  8:39   ` Valentina Manea
  3 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2014-11-30 18:14 UTC (permalink / raw)
  To: Valentina Manea; +Cc: kernel-janitors, Shuah Khan, linux-usb, linux-kernel

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

Delete a local structure that is only used to be initialized by memset.

A semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier x,i;
@@

{
... when any
-struct i x;
<+... when != x
- memset(&x,...);
...+>
}
// </smpl>

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

---
 tools/usb/usbip/src/usbipd.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/usb/usbip/src/usbipd.c b/tools/usb/usbip/src/usbipd.c
index 2f87f2d..2a7cd2b 100644
--- a/tools/usb/usbip/src/usbipd.c
+++ b/tools/usb/usbip/src/usbipd.c
@@ -91,7 +91,6 @@ static void usbipd_help(void)
 static int recv_request_import(int sockfd)
 {
 	struct op_import_request req;
-	struct op_common reply;
 	struct usbip_exported_device *edev;
 	struct usbip_usb_device pdu_udev;
 	struct list_head *i;
@@ -100,7 +99,6 @@ static int recv_request_import(int sockfd)
 	int rc;
 
 	memset(&req, 0, sizeof(req));
-	memset(&reply, 0, sizeof(reply));
 
 	rc = usbip_net_recv(sockfd, &req, sizeof(req));
 	if (rc < 0) {


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

* Re: [PATCH 4/4] usbip: remove unneeded structure
  2014-11-30 18:14 ` [PATCH 4/4] usbip: " Julia Lawall
@ 2014-12-01  8:39   ` Valentina Manea
  0 siblings, 0 replies; 7+ messages in thread
From: Valentina Manea @ 2014-12-01  8:39 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, Shuah Khan, linux-usb, LKML

On Sun, Nov 30, 2014 at 8:14 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Delete a local structure that is only used to be initialized by memset.
>
> A semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> identifier x,i;
> @@
>
> {
> ... when any
> -struct i x;
> <+... when != x
> - memset(&x,...);
> ...+>
> }
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
>  tools/usb/usbip/src/usbipd.c |    2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/tools/usb/usbip/src/usbipd.c b/tools/usb/usbip/src/usbipd.c
> index 2f87f2d..2a7cd2b 100644
> --- a/tools/usb/usbip/src/usbipd.c
> +++ b/tools/usb/usbip/src/usbipd.c
> @@ -91,7 +91,6 @@ static void usbipd_help(void)
>  static int recv_request_import(int sockfd)
>  {
>         struct op_import_request req;
> -       struct op_common reply;
>         struct usbip_exported_device *edev;
>         struct usbip_usb_device pdu_udev;
>         struct list_head *i;
> @@ -100,7 +99,6 @@ static int recv_request_import(int sockfd)
>         int rc;
>
>         memset(&req, 0, sizeof(req));
> -       memset(&reply, 0, sizeof(reply));
>
>         rc = usbip_net_recv(sockfd, &req, sizeof(req));
>         if (rc < 0) {
>

Acked-by: Valentina Manea <valentina.manea.m@gmail.com>

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

* Re: [PATCH 1/4] target: remove unneeded array
  2014-11-30 18:14 ` [PATCH 1/4] target: " Julia Lawall
@ 2014-12-02  6:12   ` Nicholas A. Bellinger
  0 siblings, 0 replies; 7+ messages in thread
From: Nicholas A. Bellinger @ 2014-12-02  6:12 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, linux-scsi, target-devel, linux-kernel

On Sun, 2014-11-30 at 19:14 +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Delete a local array that is only used to be initialized by memset.
> 
> A semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> identifier x;
> type T;
> @@
> 
> {
> ... when any
> -T x[...];
> <+... when != x
> - memset(x,...);
> ...+>
> }
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/target/target_core_pr.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 

Applied to target-pending/for-next.

Thanks Julia!

--nab


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

end of thread, other threads:[~2014-12-02  6:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-30 18:14 [PATCH 0/4] remove unneeded array Julia Lawall
2014-11-30 18:14 ` [PATCH 1/4] target: " Julia Lawall
2014-12-02  6:12   ` Nicholas A. Bellinger
2014-11-30 18:14 ` [PATCH 2/4] drivers/scsi/bfa/bfa_svc.c: remove unneeded structure Julia Lawall
2014-11-30 18:14 ` [PATCH 3/4] staging: unisys: " Julia Lawall
2014-11-30 18:14 ` [PATCH 4/4] usbip: " Julia Lawall
2014-12-01  8:39   ` Valentina Manea

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