From patchwork Wed Apr 18 11:39:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10347957 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EF2F56053F for ; Wed, 18 Apr 2018 11:41:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E58BF285E8 for ; Wed, 18 Apr 2018 11:41:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E43E5285EB; Wed, 18 Apr 2018 11:41:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46DB528604 for ; Wed, 18 Apr 2018 11:41:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753953AbeDRLlG (ORCPT ); Wed, 18 Apr 2018 07:41:06 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:6278 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753945AbeDRLlD (ORCPT ); Wed, 18 Apr 2018 07:41:03 -0400 X-IronPort-AV: E=Sophos;i="5.48,465,1517900400"; d="scan'208";a="13354611" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 18 Apr 2018 04:41:03 -0700 Received: from ajaysk-VirtualBox.mchp-main.com (10.10.76.4) by chn-sv-exch03.mchp-main.com (10.10.76.49) with Microsoft SMTP Server id 14.3.352.0; Wed, 18 Apr 2018 04:41:03 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 18/22] staging: wilc1000: remove the use of goto label in wilc_init() Date: Wed, 18 Apr 2018 17:09:20 +0530 Message-ID: <1524051564-15497-19-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524051564-15497-1-git-send-email-ajay.kathat@microchip.com> References: <1524051564-15497-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added direct return in wilc_init() instead of goto label. Changes are done to avoid the use of '_' in label name. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 65caa6d..12414f4 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3331,7 +3331,6 @@ static void get_periodic_rssi(struct timer_list *unused) int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) { - int result = 0; struct host_if_drv *hif_drv; struct wilc_vif *vif; struct wilc *wilc; @@ -3345,10 +3344,9 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) init_completion(&hif_wait_response); hif_drv = kzalloc(sizeof(*hif_drv), GFP_KERNEL); - if (!hif_drv) { - result = -ENOMEM; - goto _fail_; - } + if (!hif_drv) + return -ENOMEM; + *hif_drv_handler = hif_drv; for (i = 0; i < wilc->vif_num; i++) if (dev == wilc->vif[i]->ndev) { @@ -3359,7 +3357,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) wilc_optaining_ip = false; - if (clients_count == 0) { + if (clients_count == 0) { init_completion(&hif_thread_comp); init_completion(&hif_driver_comp); mutex_init(&hif_deinit_lock); @@ -3370,12 +3368,12 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) init_completion(&hif_drv->comp_get_rssi); init_completion(&hif_drv->comp_inactive_time); - if (clients_count == 0) { + if (clients_count == 0) { hif_workqueue = create_singlethread_workqueue("WILC_wq"); if (!hif_workqueue) { netdev_err(vif->ndev, "Failed to create workqueue\n"); - result = -ENOMEM; - goto _fail_; + kfree(hif_drv); + return -ENOMEM; } periodic_rssi_vif = vif; @@ -3403,8 +3401,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) clients_count++; -_fail_: - return result; + return 0; } int wilc_deinit(struct wilc_vif *vif)