diff mbox

[net-next,05/17] ixgb: remove open-coded skb_cow_head.

Message ID 73d3fb2312cec80d7891f8da2f7089b8c4752f9f.1396090802.git.romieu@fr.zoreil.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Francois Romieu March 29, 2014, 11:26 a.m. UTC
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgb/ixgb_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Joe Perches March 29, 2014, 12:47 p.m. UTC | #1
On Sat, 2014-03-29 at 12:26 +0100, Francois Romieu wrote:
> struct ixgb_adapter *adapter, struct sk_buff *skb)
>         if (likely(skb_is_gso(skb))) {
>                 struct ixgb_buffer *buffer_info;
>                 struct iphdr *iph;
> +               int err;
>  
> -               if (skb_header_cloned(skb)) {
> -                       err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
> -                       if (err)
> -                               return err;
> -               }
> +               err = skb_cow_head(skb, 0);
> +               if (err < 0)
> +                       return err

It seems in many instances you're adding
an unnecessary declaration of err that
shadows an already declared err


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joe Perches March 29, 2014, 1 p.m. UTC | #2
On Sat, 2014-03-29 at 05:47 -0700, Joe Perches wrote:
> On Sat, 2014-03-29 at 12:26 +0100, Francois Romieu wrote:
> > struct ixgb_adapter *adapter, struct sk_buff *skb)
> >         if (likely(skb_is_gso(skb))) {
> >                 struct ixgb_buffer *buffer_info;
> >                 struct iphdr *iph;
> > +               int err;
> >  
> > -               if (skb_header_cloned(skb)) {
> > -                       err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
> > -                       if (err)
> > -                               return err;
> > -               }
> > +               err = skb_cow_head(skb, 0);
> > +               if (err < 0)
> > +                       return err
> 
> It seems in many instances you're adding
> an unnecessary declaration of err that
> shadows an already declared err

I take back the many.  This seems to be the only one.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kirsher, Jeffrey T March 29, 2014, 7:03 p.m. UTC | #3
On Sat, 2014-03-29 at 12:26 +0100, Francois Romieu wrote:
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgb/ixgb_main.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

Thanks Francois, I have added your patch to my queue.
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index f42c201..de2ca4a 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -1225,12 +1225,11 @@  ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
 	if (likely(skb_is_gso(skb))) {
 		struct ixgb_buffer *buffer_info;
 		struct iphdr *iph;
+		int err;
 
-		if (skb_header_cloned(skb)) {
-			err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
-			if (err)
-				return err;
-		}
+		err = skb_cow_head(skb, 0);
+		if (err < 0)
+			return err;
 
 		hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
 		mss = skb_shinfo(skb)->gso_size;