diff mbox

[SCSI] fnic: use kzalloc in fnic_fcoe_process_vlan_resp

Message ID 1443729543-19362-1-git-send-email-linux@rasmusvillemoes.dk (mailing list archive)
State New, archived
Headers show

Commit Message

Rasmus Villemoes Oct. 1, 2015, 7:59 p.m. UTC
This saves a little .text and avoids the sizeof(...) style
inconsistency.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/fnic/fnic_fcs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Johannes Thumshirn Oct. 2, 2015, 7:05 a.m. UTC | #1
Rasmus Villemoes <linux@rasmusvillemoes.dk> writes:

> This saves a little .text and avoids the sizeof(...) style
> inconsistency.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/scsi/fnic/fnic_fcs.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
> index bf0bbd42efb5..2d013076bfba 100644
> --- a/drivers/scsi/fnic/fnic_fcs.c
> +++ b/drivers/scsi/fnic/fnic_fcs.c
> @@ -415,15 +415,13 @@ static void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct sk_buff *skb)
>  			vid = ntohs(((struct fip_vlan_desc *)desc)->fd_vlan);
>  			shost_printk(KERN_INFO, fnic->lport->host,
>  				  "process_vlan_resp: FIP VLAN %d\n", vid);
> -			vlan = kmalloc(sizeof(*vlan),
> -							GFP_ATOMIC);
> +			vlan = kzalloc(sizeof(*vlan), GFP_ATOMIC);
>  			if (!vlan) {
>  				/* retry from timer */
>  				spin_unlock_irqrestore(&fnic->vlans_lock,
>  							flags);
>  				goto out;
>  			}
> -			memset(vlan, 0, sizeof(struct fcoe_vlan));
>  			vlan->vid = vid & 0x0fff;
>  			vlan->state = FIP_VLAN_AVAIL;
>  			list_add_tail(&vlan->list, &fnic->vlans);

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff mbox

Patch

diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
index bf0bbd42efb5..2d013076bfba 100644
--- a/drivers/scsi/fnic/fnic_fcs.c
+++ b/drivers/scsi/fnic/fnic_fcs.c
@@ -415,15 +415,13 @@  static void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct sk_buff *skb)
 			vid = ntohs(((struct fip_vlan_desc *)desc)->fd_vlan);
 			shost_printk(KERN_INFO, fnic->lport->host,
 				  "process_vlan_resp: FIP VLAN %d\n", vid);
-			vlan = kmalloc(sizeof(*vlan),
-							GFP_ATOMIC);
+			vlan = kzalloc(sizeof(*vlan), GFP_ATOMIC);
 			if (!vlan) {
 				/* retry from timer */
 				spin_unlock_irqrestore(&fnic->vlans_lock,
 							flags);
 				goto out;
 			}
-			memset(vlan, 0, sizeof(struct fcoe_vlan));
 			vlan->vid = vid & 0x0fff;
 			vlan->state = FIP_VLAN_AVAIL;
 			list_add_tail(&vlan->list, &fnic->vlans);