From patchwork Sat Jan 2 20:54:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7940961 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 28A039F350 for ; Sat, 2 Jan 2016 20:55:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 584B320384 for ; Sat, 2 Jan 2016 20:54:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D3F120374 for ; Sat, 2 Jan 2016 20:54:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751947AbcABUyo (ORCPT ); Sat, 2 Jan 2016 15:54:44 -0500 Received: from mout.web.de ([212.227.17.12]:60842 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751751AbcABUyn (ORCPT ); Sat, 2 Jan 2016 15:54:43 -0500 Received: from [192.168.1.2] ([77.181.40.156]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0LjJH1-1Zg8F01Bl9-00dV30; Sat, 02 Jan 2016 21:54:37 +0100 Subject: [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect() To: linux-wireless@vger.kernel.org, Aloisio Almeida Jr , Lauro Ramos Venancio , Samuel Ortiz References: <566ABCD9.1060404@users.sourceforge.net> <56883849.2080304@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <5688390B.3080800@users.sourceforge.net> Date: Sat, 2 Jan 2016 21:54:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <56883849.2080304@users.sourceforge.net> X-Provags-ID: V03:K0:yAPJPpvCuCW7VYKHXG4Cv9LSPTRkf0AajAvOPpUeNmCiVrutnay rfA54Jvn/xbSZQD704Ag0DWOR/gxZwNKghOzDnpOiXNQE+7vmdMqra+Rfa/1kEJu4p+/knp KjyCZ6anr7btFVR6tDx9c05Il6eD9heTKB9hBnx1reJ771SMjlVrTGg8EoZUWy1WCBiWLVH fFq9dzT24EoBaPcmL1v+g== X-UI-Out-Filterresults: notjunk:1; V01:K0:1IvN271dZX4=:iv343642a9wpx5KwgBDQU5 ZGBiIeBHDhM9l20GnBZIqDOLMgOiGYmVnEQErLBhwQ8gUCMV+lxjm+Wj2RJXhFBWA98xZ/GrP QUSCbmqpE4rk/BMi56vFkBSpyz7DszF6/Ax1e9jssgt7eUKlPUPZIg90BY3QHW/gHxc2NHiqQ B9rt14yiwjLtjGxJgGcrK88gU8AkojuJosJRGG4udbkdfFlIS+S5tv1NgrcpYvSnkzLgxnJji eEWL3AzM8BBHuuuI8NCPVL5yD7TwZH6TpcdqmCaMX/e3jLukBONOZXodnnZ4G2/QfkUcmyf27 DzTI3pDX1psyNWLJX1pSu/OLAflCdFq2Yy92glHkHbXje7Pde/sJt/4RELVxlsZJlz38w1Gdn ObLiUOw39EZAnqoNFwExfKGMqNfyUmT/qRmXzBbXbVBqqVcFrToURlE6l/hEVJVgVfnkFRfCo cohG9gJuSP9s3rOrYxnX/29KV5lpkj1aIU1JqV4Tv96ExFjOkkDqEPlg5v+Fsnb56paWTj518 FExANLI9axAcElwbOq7VO3DgJkrl8esvdSU0p31aN2QmYgwk3Kegpv65kdV/CTUlOzNvF+EIo XZivvPNzsZI4zldSTh9TKKvxlQUn+zoe7wN4I2aaq+wQXooTDjbsr/ZIYOcJZoIHJ27tQEWTL 3kJ+kFDe8qslIJ3WsLKxdmAkpOnTdHyOU6T9J2sPQMaXEyjTNnpA94K2q5xq5juPWs7fXxUz6 WeNCrB4zQVd8pgOo91ySAegp/RFnDQz7CCDWhNKn89h5e+68aTuKSZyPznjUEW4Jiyv7X9WIl 5aBEEWU Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 2 Jan 2016 21:21:24 +0100 This issue was detected by using the Coccinelle software. Adjust jump targets according to the current Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/nfc/mei_phy.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c index 83deda4..8e3a69f 100644 --- a/drivers/nfc/mei_phy.c +++ b/drivers/nfc/mei_phy.c @@ -173,8 +173,8 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy) reply = kzalloc(connect_resp_length, GFP_KERNEL); if (!reply) { - kfree(cmd); - return -ENOMEM; + r = -ENOMEM; + goto free_cmd; } connect_resp = (struct mei_nfc_connect_resp *)reply->data; @@ -189,7 +189,7 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy) r = mei_cldev_send(phy->cldev, (u8 *)cmd, connect_length); if (r < 0) { pr_err("Could not send connect cmd %d\n", r); - goto err; + goto free_reply; } bytes_recv = mei_cldev_recv(phy->cldev, (u8 *)reply, @@ -197,7 +197,7 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy) if (bytes_recv < 0) { r = bytes_recv; pr_err("Could not read connect response %d\n", r); - goto err; + goto free_reply; } MEI_DUMP_NFC_HDR("connect reply", &reply->hdr); @@ -210,11 +210,10 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy) connect_resp->me_hotfix, connect_resp->me_build); r = 0; - -err: +free_reply: kfree(reply); +free_cmd: kfree(cmd); - return r; }