Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755632AbeAJKZC (ORCPT + 1 other); Wed, 10 Jan 2018 05:25:02 -0500 Received: from mout.web.de ([212.227.17.11]:54276 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbeAJKY5 (ORCPT ); Wed, 10 Jan 2018 05:24:57 -0500 Subject: [PATCH 3/4] sgi-xpnet: Use common code in xpnet_dev_hard_start_xmit() From: SF Markus Elfring To: kernel-janitors@vger.kernel.org, Arnd Bergmann , Cliff Whickman , Greg Kroah-Hartman , Robin Holt Cc: LKML References: Message-ID: <1a05cc59-2d61-0152-798e-4d2f75094129@users.sourceforge.net> Date: Wed, 10 Jan 2018 11:24:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:h+cY0XOA5PZAPtmHSwl64911Nu2iYn/AaSqFcv+6JL4QoIf3f8+ AEU8xOQZ20Df0iENda+PnaEpWjSLEkPwj0Im+bo5yV094Qn/0bcrYR7nGq2brThTONhDUuT 0+jqm2SQfmEjKWzJAd+dRgUKRvnVqnC/7va8y1vEy2aF60N19ExNcYL/B4k6JkKJrg9ZYlC cUXfOAgG5QBYa5PPgachw== X-UI-Out-Filterresults: notjunk:1;V01:K0:2Fbuv/UF5B8=:pYs2NtSK+ebKJVMGXSeujR 1K6YbaTwsXBu1lqpfnRp4Tef7yqajV9WtxK5dxTYEgpoidOLyb0LBgxoc+UkZToWvXVjG4lod 4u6oHlMCFbyICvQEvb6o7JXqL77D7OCk08fhzUeCpBlhSQrpzBsGpncQIhDpd5aKUlULOCjAn vta4KmbSaMLXRBv+Q0if1R99mTDJeMRgu1TBNwlZgbmTPb0M0BTPgRDuzaH5Pj2WolvFXiwFN f/CjLYXRYXb+zcOT+7Txj7xrmNT31CCgrN76yiSe4tuhbCqMC1NCMyZVV3y7V0K2qd7u4OHtv XiQBamgxJsNVw+bM1NNs/cSy1DZZnzM9Em9Qt0rll/WrNUMEDQw5dqsqcLxIR06+VCuAiml0H UX9jAXqwIyvpcLLOun1Bp2PjoXqDjVQkoVaepe8cKgQJ3lH/qQmJh8C93iXDK00+2LSIxu2te x1YGri3J1TJ24dknFlwMc/v+1BpTOIKa9LCq8E5rHRdPHCdGShMvJexYx6Wt0GDsUD9f9mqOf IYWiQZeLK0BwGdSDiiYFaEpoHgJkMdqDodvi4/4chFPvOVWE19j4Hb6H8I0aJISLNVZyuoSvm DKcowk6TobaTzyMQ3rlux/RfXy2szJetGn5enMbWBlgBcl3XA3c7rYVkJ+FDuRYfkvmca8f5R rbfYx3eHF/Dc1Xo+VbWxEQGX8fbU7GnaD55svKIEhfbmGz6OQkV8o/AE6mFUzkPedx8l9NXrK 5P+IylO1K6rj/R+JhEyMqjIp/rbsTyN+JvA9U5XM78gmSKn2htSOXYBws+WFUdZcXpITBjgTO QjN7JtPMK1sgDId8mEaZ+pTx6kOrxCe9D/ovgjyZVXvhrJOgs8= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring Date: Wed, 10 Jan 2018 10:50:10 +0100 Add a jump target so that a bit of code can be better reused at the end of this function. Signed-off-by: Markus Elfring --- drivers/misc/sgi-xp/xpnet.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c index a4415616c03c..088c96a883f9 100644 --- a/drivers/misc/sgi-xp/xpnet.c +++ b/drivers/misc/sgi-xp/xpnet.c @@ -416,11 +416,8 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) "skb->end=0x%p skb->len=%d\n", (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), skb->len); - - if (skb->data[0] == 0x33) { - dev_kfree_skb(skb); - return NETDEV_TX_OK; /* nothing needed to be done */ - } + if (skb->data[0] == 0x33) + goto free_skb; /* * The xpnet_pending_msg tracks how many outstanding @@ -430,8 +427,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) queued_msg = kmalloc(sizeof(*queued_msg), GFP_ATOMIC); if (queued_msg == NULL) { dev->stats.tx_errors++; - dev_kfree_skb(skb); - return NETDEV_TX_OK; + goto free_skb; } /* get the beginning of the first cacheline and end of last */ @@ -479,11 +475,15 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) dev->stats.tx_bytes += skb->len; if (atomic_dec_return(&queued_msg->use_count) == 0) { - dev_kfree_skb(skb); kfree(queued_msg); + goto free_skb; } return NETDEV_TX_OK; + +free_skb: + dev_kfree_skb(skb); + return NETDEV_TX_OK; } /* -- 2.15.1