Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751225AbcCFAAV (ORCPT ); Sat, 5 Mar 2016 19:00:21 -0500 Received: from mail-am1on0075.outbound.protection.outlook.com ([157.56.112.75]:40592 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750836AbcCFAAR convert rfc822-to-8bit (ORCPT ); Sat, 5 Mar 2016 19:00:17 -0500 X-Greylist: delayed 160307 seconds by postgrey-1.27 at vger.kernel.org; Sat, 05 Mar 2016 19:00:16 EST From: Fugang Duan To: Nicholas Krause , "davem@davemloft.net" CC: "b38611@freescale.com" , "andrew@lunn.ch" , "fabio.estevam@freescale.com" , "l.stach@pengutronix.de" , "rmk+kernel@arm.linux.org.uk" , "tremyfr@gmail.com" , "johannes@sipsolutions.net" , "u.kleine-koenig@pengutronix.de" , "haokexin@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH RESEND] net:fec:Fix error checking in the function fec_enet_init Thread-Topic: [PATCH RESEND] net:fec:Fix error checking in the function fec_enet_init Thread-Index: AQHRdlCAN78MHaMffkSxhGMRCcWvmZ9LiWgA Date: Sun, 6 Mar 2016 00:00:11 +0000 Message-ID: References: <1457121614-9360-1-git-send-email-xerofoify@gmail.com> In-Reply-To: <1457121614-9360-1-git-send-email-xerofoify@gmail.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [139.227.81.99] x-ms-office365-filtering-correlation-id: bebb1ae1-abc5-4329-28e6-08d345524a01 x-microsoft-exchange-diagnostics: 1;HE1PR0401MB1850;5:yhIhmVdIRo4QQXX8niH3iH97UvP5c6Kohah+CPWnexh9dRHxfV2Wqu+gka9DVR8CTRm69437GELF9hxNng88oue7xQjEu2+Sx2JK+NEjMV1ifFGqrMkY8iCxNuMMgCMW+YAOAxBAIlCmFl3mIU2bxw==;24:0XBifSVor+uLQE9ZfSj52Vyb4fm6ZZq4cyFCOM14bH1IUD/4naE0LUFvAg9FxN04fkO9JK0668ayvkmXfx9fj5jZv5flwaEJPEIWum+gAZQ= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0401MB1850; x-ld-processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046);SRVR:HE1PR0401MB1850;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0401MB1850; x-forefront-prvs: 087396016C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(377454003)(5002640100001)(5001770100001)(106116001)(122556002)(19580395003)(40100003)(19580405001)(5003600100002)(77096005)(33656002)(3280700002)(3900700001)(3660700001)(87936001)(86362001)(2906002)(4326007)(81166005)(2501003)(189998001)(11100500001)(2950100001)(2900100001)(5004730100002)(76176999)(54356999)(6116002)(50986999)(92566002)(5008740100001)(74316001)(10400500002)(1096002)(1220700001)(3846002)(586003)(102836003)(76576001)(66066001)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0401MB1850;H:HE1PR0401MB1849.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2016 00:00:11.3252 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB1850 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1697 Lines: 47 From: Nicholas Krause Sent: Saturday, March 05, 2016 4:00 AM > To: davem@davemloft.net > Cc: b38611@freescale.com; andrew@lunn.ch; fabio.estevam@freescale.com; > l.stach@pengutronix.de; rmk+kernel@arm.linux.org.uk; tremyfr@gmail.com; > johannes@sipsolutions.net; u.kleine-koenig@pengutronix.de; > haokexin@gmail.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: [PATCH RESEND] net:fec:Fix error checking in the function > fec_enet_init > > This fixes error checking in the function fec_enet_init to properly check if the > internal call to the function fec_enet_alloc_queue fails and if so immediately > return the error code to the caller for it to handle it's own intended error paths. > > Signed-off-by: Nicholas Krause > --- > drivers/net/ethernet/freescale/fec_main.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/freescale/fec_main.c > b/drivers/net/ethernet/freescale/fec_main.c > index b349e6f..18c625f 100644 > --- a/drivers/net/ethernet/freescale/fec_main.c > +++ b/drivers/net/ethernet/freescale/fec_main.c > @@ -3123,6 +3123,7 @@ static int fec_enet_init(struct net_device *ndev) > dma_addr_t bd_dma; > int bd_size; > unsigned int i; > + int ret; > > #if defined(CONFIG_ARM) > fep->rx_align = 0xf; > @@ -3132,7 +3133,9 @@ static int fec_enet_init(struct net_device *ndev) > fep->tx_align = 0x3; > #endif > > - fec_enet_alloc_queue(ndev); > + ret = fec_enet_alloc_queue(ndev); > + if (ret) > + return ret; > > if (fep->bufdesc_ex) > fep->bufdesc_size = sizeof(struct bufdesc_ex); > -- > 2.1.4 Thanks. Acked-by: Fugang Duan