From patchwork Sun Nov 6 13:34:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Straube X-Patchwork-Id: 16140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1500123wru; Sun, 6 Nov 2022 05:44:36 -0800 (PST) X-Google-Smtp-Source: AMsMyM7VRAvtzywPdKAbbFVE/DxLDmhSse93YtXudES0V2yH2hRviDSwcIATYySTBsujWf5fiwru X-Received: by 2002:a17:907:1dc7:b0:7ad:83d5:6abd with SMTP id og7-20020a1709071dc700b007ad83d56abdmr41616793ejc.412.1667742276384; Sun, 06 Nov 2022 05:44:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667742276; cv=none; d=google.com; s=arc-20160816; b=ySrH9npsnfatgEKoItwNMyloYJTWnJz6DVWgYRqMW94IffYvuVaS9BYX53+tm+HFxv vQwLPR9U4gak5xNehKV/rRjpibVaWWHYRgqn0L3xvoBlCIfGWY4qxOoYgLL8S0+kYlX3 kYs0Ji4hWnzWsWSpm0IeYyjDy6YUKez6Oj3nWgHrI9qhBCBB5XVO4IHe80kIW/hj5Buq XRCdVtx2VePXGCLZP3hK7BuDcAgTxZHixzItO/hk0Pp0i3vf4v+q+cGfCbxILdvjlVPF WnQo27zag59F5gccux7QbRJ5TYkHguoaZ+/zDGbixPhDUUoPT46qq+3o5PF/bTS958+Y qXUQ== 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=vczVhc3OPBbJJv7puS37X+vgFWWnV3V2UNdSHwQBMYc=; b=0UAMN1uJcoJj7CXaFDylVg103r4YnasoF0gR8RKcj9kbNMXRFlR6CoHcH+sZTK1Cio IrtVXZR7Y/xm8b/H0P9qUEvOGZnrIdg4dqxer6x4DbhjgBMjMcO0PYMIYAYQr5D8nKbZ QviIeV3CFKXrRSD+Oq/X4LB/HkNK/rSTqcypABMGczl5ah/h1fnBqJ0y5cCZf/rVunUw mUrIxDAtSLGQzjtyd3asPUxHRbgfF3+0JahOOVvBbqNK7UnZ0GwToQVoUlHSQcpTEQKt foOzHW4vYaLbIoK8zyEjIDyfrsCi6nrDGCIXp7MLWGVOMKbuzaP8hGWYKVEEpP/TxCiu fScA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="i1b1IJU/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs13-20020a170906dc8d00b007a8a40e6146si5813228ejc.363.2022.11.06.05.44.12; Sun, 06 Nov 2022 05:44:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="i1b1IJU/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229975AbiKFNe5 (ORCPT + 99 others); Sun, 6 Nov 2022 08:34:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbiKFNez (ORCPT ); Sun, 6 Nov 2022 08:34:55 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7E57DFBD for ; Sun, 6 Nov 2022 05:34:54 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id l11so13829515edb.4 for ; Sun, 06 Nov 2022 05:34:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vczVhc3OPBbJJv7puS37X+vgFWWnV3V2UNdSHwQBMYc=; b=i1b1IJU/LpVhIaTvS94dUc2JKge3gJ6cj0xyMOOnQLqDgOEnYFCjY8jrr6cHsQwPot gg75MroaDsVi+JOeSjYDsJUR8/aVLPF/xmq+wCulcgZri2P1+PM2+ieYK09NQt12N1Pb gKfaYTqbwd7uY1lg88saCybSe/MukoIFM++tgDuV3057/dPcS5Crbmp3u1rxNyCG3Yvw bFrSraUWHeLs6go9xfRuRoLEmMdJGzyPXa6Nt9XVlNsFGb+FSEuhprfgD/uNvtMBHokQ MRN8pTDBEvgBLWaXT6i3mkG+DN4EQQwHWeAnBJAcwok9xtIsm+TlVBIstiGpy321oOLx AcBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vczVhc3OPBbJJv7puS37X+vgFWWnV3V2UNdSHwQBMYc=; b=vT65OFtEM9K19qg7s3PN3m/KS6uOuBPi/+MJ7R+AWTW5ag409a6etdOsAXZr1m5YmH P9mmVAm3Q3uGvOyrr4lL/jtKHbIEj2l2rqiInnk8q2dezhGSoAC9zC2dW8k4x571gJkF K0+NvTSvQOXeehqJ9fmJ98GvA8Jskb/v/XewA32QlvgCZcktY+3sO50ndkUsuAJqJMgA RaMoCU6QLjgnKSVJ4y3stXGqGkFQWPFTzuTlOd4Dx3zEmzoskUPcLmstlvyU4Ien4zVg 35BOEU0DVlODFgRPM+NdR0q+prSnFbmXQhsfLrQaSGWEHqHga2udWJS3g1m25cmJ6tzW O58Q== X-Gm-Message-State: ACrzQf1iKqZMop8AJ82AFBIFU2MBOgZiJMntJPII9xRjEqIT1uKSEAKn haOzGWNOUfgbK8aiErq88tk= X-Received: by 2002:a05:6402:1ca9:b0:461:30d8:6742 with SMTP id cz9-20020a0564021ca900b0046130d86742mr601164edb.172.1667741693392; Sun, 06 Nov 2022 05:34:53 -0800 (PST) Received: from localhost.localdomain (ip5f5abba7.dynamic.kabel-deutschland.de. [95.90.187.167]) by smtp.gmail.com with ESMTPSA id lj18-20020a170906f9d200b007adade0e9easm2103614ejb.85.2022.11.06.05.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Nov 2022 05:34:52 -0800 (PST) From: Michael Straube To: gregkh@linuxfoundation.org Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Michael Straube Subject: [PATCH] staging: r8188eu: clean up error handling in rtw_start_drv_threads() Date: Sun, 6 Nov 2022 14:34:43 +0100 Message-Id: <20221106133443.8872-1-straube.linux@gmail.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748754525279119207?= X-GMAIL-MSGID: =?utf-8?q?1748754525279119207?= Convert the error handling in the function rtw_start_drv_threads() to the common logic used in the kernel. Another step to get rid of _FAIL and _SUCCESS which uses inverted logic. Signed-off-by: Michael Straube Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/include/osdep_intf.h | 2 +- drivers/staging/r8188eu/os_dep/os_intfs.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/staging/r8188eu/include/osdep_intf.h b/drivers/staging/r8188eu/include/osdep_intf.h index 0f7d74a3ff6d..6d66cb57225e 100644 --- a/drivers/staging/r8188eu/include/osdep_intf.h +++ b/drivers/staging/r8188eu/include/osdep_intf.h @@ -46,7 +46,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter); void rtw_free_drv_sw(struct adapter *padapter); void rtw_reset_drv_sw(struct adapter *padapter); -u32 rtw_start_drv_threads(struct adapter *padapter); +int rtw_start_drv_threads(struct adapter *padapter); void rtw_stop_drv_threads (struct adapter *padapter); void rtw_cancel_all_timer(struct adapter *padapter); diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c index 970f380bac96..66556e07ed93 100644 --- a/drivers/staging/r8188eu/os_dep/os_intfs.c +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c @@ -363,18 +363,16 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) return pnetdev; } -u32 rtw_start_drv_threads(struct adapter *padapter) +int rtw_start_drv_threads(struct adapter *padapter) { - u32 _status = _SUCCESS; - padapter->cmdThread = kthread_run(rtw_cmd_thread, padapter, "RTW_CMD_THREAD"); if (IS_ERR(padapter->cmdThread)) - _status = _FAIL; - else - /* wait for rtw_cmd_thread() to start running */ - wait_for_completion(&padapter->cmdpriv.start_cmd_thread); + return PTR_ERR(padapter->cmdThread); - return _status; + /* wait for rtw_cmd_thread() to start running */ + wait_for_completion(&padapter->cmdpriv.start_cmd_thread); + + return 0; } void rtw_stop_drv_threads(struct adapter *padapter) @@ -627,8 +625,7 @@ static int _netdev_open(struct net_device *pnetdev) netdev_dbg(pnetdev, "MAC Address = %pM\n", pnetdev->dev_addr); - status = rtw_start_drv_threads(padapter); - if (status == _FAIL) { + if (rtw_start_drv_threads(padapter)) { pr_info("Initialize driver software resource Failed!\n"); goto netdev_open_error; }