Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3684076ybi; Mon, 27 May 2019 04:20:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwR4cd2rAelXwlD8eBo44MUzUiVxfa1ogZ4gL/8Wfg5d/3Q382B5a7iTQC9m3zd7QOsuNkW X-Received: by 2002:a17:902:7089:: with SMTP id z9mr31772268plk.335.1558956016608; Mon, 27 May 2019 04:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558956016; cv=none; d=google.com; s=arc-20160816; b=bKz9bFMFh27CW/ZqDaXYN58v9rsjaKhByVOQngsLM2rlEctj1m2nuCUx9N/22U/QVK lm868UesYWi/I+ilCF4OWkMb91UPwO2zezh4Gyu3YgLhQcsEDNkEX4dRmGEuswwSR23I g37Pk2oThWWY8r9Ovdjgg80wwOoktR6cHPqqZJtYWsGqbedDgTfZhs0xKe40rP3ayEF7 /YAEOyxy3QxfNTVf2OOXf/943Pq/7lSeqTmUjGoTmv/8nNB/mZEWoRY2bfZs/LKrKWCz mofZd63cxNyzfxAErhVkf5PdbdRDLwVGc1rhd7jCyZJRd+a9TNN6M6lhahY1kAxs4Z3A LC/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=gG629QXx8FdyEOPr9ywHpRzo7CmvFkkUA0RLj7yTFGo=; b=fx64lf+M+lX9R+YbPRDrjOsSGZgH0CeQFN8FEIXl+iTHEEwCam2n2jWWKtLTixSVox EunXc8IepiSU9CDY9bSxIs6C8Qi5lCcRjAxJ8PZMXXq9nFzHNjJ5gDykg3fllc0dtgQn /giU9LcxvsTWQ9X9aF4vIvl5k8fv7OrQ9bJ9nQ/bCdeZVHIqEUTSFKu79OplsNU8XmG/ Omc2R/6YjlvcQFSathIpgsp5b9Zdaen104nWz5aYLFMgQ9j3qPHWoHd9tf36nablndVR BexS+5EfIi4fsYBE4ma8Jm77GNcGRfLDInSn6tUAZtx0tlXaWKe7LVZTFaRhmtFAG0Ve F3aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-Synaptics-onmicrosoft-com header.b=ErWdXyGs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r132si17574277pfr.275.2019.05.27.04.20.00; Mon, 27 May 2019 04:20:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-Synaptics-onmicrosoft-com header.b=ErWdXyGs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726666AbfE0LRj (ORCPT + 99 others); Mon, 27 May 2019 07:17:39 -0400 Received: from mail-eopbgr710060.outbound.protection.outlook.com ([40.107.71.60]:48973 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725814AbfE0LRi (ORCPT ); Mon, 27 May 2019 07:17:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gG629QXx8FdyEOPr9ywHpRzo7CmvFkkUA0RLj7yTFGo=; b=ErWdXyGsZI8rrf/LELXu4VLzktWyg1B7suCT6KHUyRq9y5c6NBWCtL27tOEKmRHB7ILp1iZFZv5eZhV9TZ6+nxCBzMLIVxIWrWaD3YqXcWxYRumXfejaY+erY6quCY2mH6XnzB3zPBzN9lGpxQXKjSqXBlSStRSQ6ME6JozvNJ4= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB4758.namprd03.prod.outlook.com (20.179.92.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.18; Mon, 27 May 2019 11:17:34 +0000 Received: from BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::e484:f15c:c415:5ff9]) by BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::e484:f15c:c415:5ff9%7]) with mapi id 15.20.1922.021; Mon, 27 May 2019 11:17:34 +0000 From: Jisheng Zhang To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" CC: "netdev@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH net-next] net: stmmac: Switch to devm_alloc_etherdev_mqs Thread-Topic: [PATCH net-next] net: stmmac: Switch to devm_alloc_etherdev_mqs Thread-Index: AQHVFH3IrxvNh8wfqUaLjPCBqcAB3A== Date: Mon, 27 May 2019 11:17:34 +0000 Message-ID: <20190527190833.5955c851@xhacker.debian> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [124.74.246.114] x-clientproxiedby: TYAPR03CA0017.apcprd03.prod.outlook.com (2603:1096:404:14::29) To BYAPR03MB4773.namprd03.prod.outlook.com (2603:10b6:a03:134::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 15017929-6127-4655-ec1c-08d6e294ea97 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:BYAPR03MB4758; x-ms-traffictypediagnostic: BYAPR03MB4758: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:457; x-forefront-prvs: 0050CEFE70 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(136003)(39860400002)(189003)(199004)(99286004)(476003)(68736007)(486006)(86362001)(71200400001)(1076003)(6486002)(71190400001)(305945005)(5660300002)(14454004)(102836004)(7736002)(6436002)(316002)(256004)(14444005)(186003)(26005)(66476007)(4326008)(73956011)(2906002)(386003)(6506007)(66556008)(64756008)(66946007)(110136005)(66446008)(54906003)(25786009)(478600001)(8676002)(6116002)(81166006)(81156014)(50226002)(72206003)(8936002)(52116002)(3846002)(66066001)(6512007)(53936002)(9686003)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR03MB4758;H:BYAPR03MB4773.namprd03.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:0; received-spf: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: YqpdWlhULodD0JEhUASUU2DASiZ3Q9iLNtkVS8LlgyHRzlkZr25pubPjLKlb3AV5KPJL5xqUJzBr9Yib5jG690rYw1VreCt1TWFqtYdu0ebGt6z7UvD44ip8eMfBb4mLz8eHv/3up6Md8xbkP0kCJD38IvnR9XArvtojmw4L/LvUhXUPayGBGDi+bn47aBLgD1pY/wL/upUEgRnLzRT5zC4Vzrsaf7q236w/1IkLF0FdXlfQlsU6vQAjJssu5DHACzZ8PGNtzmmNbfLXdD+OA75C7C+dtuZ+0oq0whiEej5xu+znMgpq0AmMgGyvBfyGVa62ab72DvndYl3KycstL6uXTWsyd0cizYtIqntBEmLrdjQRiQGEcaeD33cYVNSatbBYDzgcWNcvwrJgAJ3aRxZRc9ot2fKV+IxjfaR/CbE= Content-Type: text/plain; charset="us-ascii" Content-ID: <97DBF27A6D764C4EB47AE73D4219A661@namprd03.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15017929-6127-4655-ec1c-08d6e294ea97 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 May 2019 11:17:34.2143 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jiszha@synaptics.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4758 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make use of devm_alloc_etherdev_mqs() to simplify the code. Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index a87ec70b19f1..08022fbcb67a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4243,9 +4243,9 @@ int stmmac_dvr_probe(struct device *device, u32 queue, maxq; int ret =3D 0; =20 - ndev =3D alloc_etherdev_mqs(sizeof(struct stmmac_priv), - MTL_MAX_TX_QUEUES, - MTL_MAX_RX_QUEUES); + ndev =3D devm_alloc_etherdev_mqs(sizeof(struct stmmac_priv), + MTL_MAX_TX_QUEUES, + MTL_MAX_RX_QUEUES); if (!ndev) return -ENOMEM; =20 @@ -4277,8 +4277,7 @@ int stmmac_dvr_probe(struct device *device, priv->wq =3D create_singlethread_workqueue("stmmac_wq"); if (!priv->wq) { dev_err(priv->device, "failed to create workqueue\n"); - ret =3D -ENOMEM; - goto error_wq; + return -ENOMEM; } =20 INIT_WORK(&priv->service_task, stmmac_service_task); @@ -4434,8 +4433,6 @@ int stmmac_dvr_probe(struct device *device, } error_hw_init: destroy_workqueue(priv->wq); -error_wq: - free_netdev(ndev); =20 return ret; } @@ -4472,7 +4469,6 @@ int stmmac_dvr_remove(struct device *dev) stmmac_mdio_unregister(ndev); destroy_workqueue(priv->wq); mutex_destroy(&priv->lock); - free_netdev(ndev); =20 return 0; } --=20 2.20.1