Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2089382pxb; Wed, 9 Feb 2022 10:35:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDW+8bmM2jhlYgfqqQQp0y69CFAF4zvmwxIGDe8Vyd+Aibn3itZ0c50j4l7CyznpAS5mjn X-Received: by 2002:a05:6a00:1d8b:: with SMTP id z11mr3559194pfw.17.1644431748045; Wed, 09 Feb 2022 10:35:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644431748; cv=none; d=google.com; s=arc-20160816; b=DBW15btBs/gAkQFev4a6kHtc1B6Qzvgeqop13kddIv0+sWqFJxZ1p06uO2WXguoV+z aLlsT/P7BV+C9CGpVgx6Z5gUW0SYvnpQTbu9sN4WLNzzi6xVtSPxUFdxyhtMDnpdCHff 2+ssq8+MLm85RgBcwpMvzog/ypS3kIFiEwYECuoPmZ+O0YK7e/vupNIL0W+mZeR3pA0G +osp8q/Wfs2BOVqEjTLt+R2t+uAMwlJhIMNr1PtkWs2xZqSXnu26qlJJCV45IWESYwQB FyUTV7WmZZXDz0e/95cWzNIBop9OHKVdRCVyqtqAkQcUbcep7Zx8vW4TP+SnY4L4x2OM WLBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=F4NxIfE5pVavXfL1FvTbYlzlRXtKoW9v/Q8Zml6o1ow=; b=Ytg3JB938X94ilIbIWLIdRCNvKbft7eeJWeujsud+raJj7setpT4Zq75/OitNiLiDJ b1WMnB3N5dKLqXMlv7eUjz0TSQKKEP2XCTfP3xQApyh/rsd+dz2q1e5p7/M2w0EIckFh 98zXEtoJsyR3OvdJxHwC3S9KxfvuL6CbK72Rvky0cYSIWr1AsHfWxMPn53My2QAj9gkf fZ92hP1QLz/p3PVor1z/ftZs5EKb9KvrXFXbTX+eQGd+8yy0TsSnud4ww3EhzWmXK8SO mYasNwkbKaR474xMEghnPhxELjMvNhTrhpnMP0ZMcZh1c/j8xALFDgx0SKgXQdwj20te k1+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FnHlQw2m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx9si7212666pjb.183.2022.02.09.10.35.36; Wed, 09 Feb 2022 10:35:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FnHlQw2m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238436AbiBIRs0 (ORCPT + 99 others); Wed, 9 Feb 2022 12:48:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238428AbiBIRsZ (ORCPT ); Wed, 9 Feb 2022 12:48:25 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 045BCC05CB82 for ; Wed, 9 Feb 2022 09:48:28 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id c8-20020a17090a674800b001b91184b732so3391864pjm.5 for ; Wed, 09 Feb 2022 09:48:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=F4NxIfE5pVavXfL1FvTbYlzlRXtKoW9v/Q8Zml6o1ow=; b=FnHlQw2mxdJHKxT0xdfJqo6x7F6mCMHP+mESAoq+Oa4dV2IB/I7ZUOQUZOw1FLno89 9Dtdwba6ioD6tXAJAYWwXkBX5VQzA3nUPQnzMnFepNLmIiAGtgwsXirfDwNZiURC4XBE NaZF0Np4P5GAp4XynEqfImAOUC551BywtCm6Jb1/Bt5Ih6EtrI/9w0B+3lfcEYt5liFI wSMzY2wax+3G7vSc5A9QHVyf2tJU/Y8gqKtTWHfB2+InN/Giab3C36UCc39UBn3W6+ga +A/1CwVifby6nYBItpT9UhgoZmHIru6GUGmnFB40CGSnCwzPzfoO1Jw0MLf9fN7Vi2Nl hmRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=F4NxIfE5pVavXfL1FvTbYlzlRXtKoW9v/Q8Zml6o1ow=; b=pdw4YiLhh/vd476+vl45SksoUvTkwJH7F+BwmChROz6g9yxjgrTKM+66F4JUNBxWEQ ts9J3Oe9bYFD61Y8WzqVCz7HC5xF/W9XQ1zs4+yGV5GUKOY3BC9ygMrh1V+LW2yLEh8W /qygn3iFDkng/LfhDOfbC0GhX7mXfjl85yz0Es2FMlCMlC7NvHs1AIdHhQlQvCAUFCp9 9Bkj4/l/4Jr5Cnfbhp4DMIGmp30EqcdaAzdu5IQHqWDmee+wZdCQ6jQQPPF0RyO3Xjyd czv5MImxaatJjnql0gelLibTRjTmUN6WslILZp9d7nqFWLQEEuRskitwqFNosEHvvQAC HI5A== X-Gm-Message-State: AOAM531Wp1Ax+J+bkcjtrsk/26po7qQdhzXCnAzjZexwv+aHApGyQOFY pwLLoqcKr8Ub9sCNtG8d9HY= X-Received: by 2002:a17:903:2083:: with SMTP id d3mr3235951plc.174.1644428907530; Wed, 09 Feb 2022 09:48:27 -0800 (PST) Received: from localhost.localdomain ([103.81.93.149]) by smtp.gmail.com with ESMTPSA id mw14sm7462786pjb.6.2022.02.09.09.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 09:48:27 -0800 (PST) From: Vihas Makwana To: Larry Finger , Phillip Potter , Greg Kroah-Hartman , Michael Straube , Martin Kaiser Cc: Dan Carpenter , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Vihas Makwana Subject: [PATCH] staging: r8188eu: keep the success path and error path separate Date: Wed, 9 Feb 2022 23:18:19 +0530 Message-Id: <20220209174819.5068-1-makvihas@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Keep the success path and error path separate in rtw_usb_if1_init() and drop the "status" variable. Also, remove do-nothing gotos. Signed-off-by: Vihas Makwana --- drivers/staging/r8188eu/os_dep/usb_intf.c | 29 ++++++++++------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c index 10c33e2ae..4ddf3a95a 100644 --- a/drivers/staging/r8188eu/os_dep/usb_intf.c +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c @@ -336,13 +336,13 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, { struct adapter *padapter = NULL; struct net_device *pnetdev = NULL; - int status = _FAIL; struct io_priv *piopriv; struct intf_hdl *pintf; padapter = vzalloc(sizeof(*padapter)); if (!padapter) - goto exit; + return NULL; + padapter->dvobj = dvobj; dvobj->if1 = padapter; @@ -421,25 +421,20 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, , padapter->hw_init_completed ); - status = _SUCCESS; + return padapter; free_drv_sw: - if (status != _SUCCESS) { - rtw_cancel_all_timer(padapter); - rtw_free_drv_sw(padapter); - } + rtw_cancel_all_timer(padapter); + rtw_free_drv_sw(padapter); handle_dualmac: - if (status != _SUCCESS) - rtw_handle_dualmac(padapter, 0); + rtw_handle_dualmac(padapter, 0); free_adapter: - if (status != _SUCCESS) { - if (pnetdev) - rtw_free_netdev(pnetdev); - else if (padapter) - vfree(padapter); - padapter = NULL; - } -exit: + if (pnetdev) + rtw_free_netdev(pnetdev); + else if (padapter) + vfree(padapter); + padapter = NULL; + return padapter; } -- 2.30.2