From patchwork Fri Jun 19 14:32:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 223632 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 917D1C433DF for ; Fri, 19 Jun 2020 16:53:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6615520734 for ; Fri, 19 Jun 2020 16:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592585593; bh=nsW59QYiE+70W8//0AtPqDPYbwUyl/wZLv8TQkNyFTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Khzy8O/j66hk5wfF90PJ4I4hKuKnl5vE85wGlc1RQM5zvvyIksDE8fuUZZGZhIBQM 1uoqETDrfuTow0pIy6kI6uMuH33bw0yB7hIVzTjbkmzHAJ7fR9Py09UHj7chKka6aK J9Kv7z9l/fIK7wELruid+waHLQtwZN9ZsjXorZ4o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394106AbgFSQwp (ORCPT ); Fri, 19 Jun 2020 12:52:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:54710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733177AbgFSOhr (ORCPT ); Fri, 19 Jun 2020 10:37:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 28219208B8; Fri, 19 Jun 2020 14:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592577467; bh=nsW59QYiE+70W8//0AtPqDPYbwUyl/wZLv8TQkNyFTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w1gOVo6jBmp9DDPaBk2bcltP46kr6gefLDFzJ0ggiK3IdTyq+iL0wLVjCrRqifXvd +8edmDHhvoPO8UOdoODZ8IPYB/aGIr3W79exmrNCi7va3IyZlI397LOnxQsIE375Jf GQEphEe4dDh/KdS9IMeAt55ALxfZfzq2IBup4ecI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunjian Wang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.4 061/101] net: allwinner: Fix use correct return type for ndo_start_xmit() Date: Fri, 19 Jun 2020 16:32:50 +0200 Message-Id: <20200619141617.245383704@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141614.001544111@linuxfoundation.org> References: <20200619141614.001544111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yunjian Wang [ Upstream commit 09f6c44aaae0f1bdb8b983d7762676d5018c53bc ] The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix the ndo function to use the correct type. And emac_start_xmit() can leak one skb if 'channel' == 3. Signed-off-by: Yunjian Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/allwinner/sun4i-emac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 8d50314ac3eb..dde3cd2d4763 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -438,7 +438,7 @@ static void emac_timeout(struct net_device *dev) /* Hardware start transmission. * Send a packet to media from the upper layer. */ -static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t emac_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct emac_board_info *db = netdev_priv(dev); unsigned long channel; @@ -446,7 +446,7 @@ static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev) channel = db->tx_fifo_stat & 3; if (channel == 3) - return 1; + return NETDEV_TX_BUSY; channel = (channel == 1 ? 1 : 0);