Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2683893iog; Mon, 20 Jun 2022 02:20:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v5DgGXBxDMKnVKvVGZCItDpEJ38clBzPTZ/Zp32cPkYiQuCmo1TUruszWKXstqtwp21zpJ X-Received: by 2002:a05:6402:5409:b0:42a:a643:4eb8 with SMTP id ev9-20020a056402540900b0042aa6434eb8mr28608315edb.71.1655716859454; Mon, 20 Jun 2022 02:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655716859; cv=none; d=google.com; s=arc-20160816; b=WwP0Ip/N83tQR+3UcoBem45SM9KOdTNYMDefssgOzziBPCY7Jy2G8O3Kon7R1z71gI 5SA2O6bfW1fTjgdrMpk8+nOYil4fykSdUu0v+geHB+1ljpt9WNTJca5UfhiWLROe/JHC sngo3ir9tntl2gZlb0q8/TdLIqmk/MsDGoRRyxwLaSnDC5xlgLoMYyyfmE/DBQwrvh3c YQa69yqMrqbia/SITPfbS43WWMxE0X6aC3dlbpXr2BdESKiwTo+DAYIXykh8zDjNy7tg of83T0VTIqqtEdI35shk5LFTlmm03W51efvgvynaOLYoZOYWu+eqxu3XAuhqghFqKWa7 1Csg== 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=tK/eeW1pWNOA//wEcdfUutwvJ2rc5cXMd97zpjA0M+4=; b=v7SQoGjPAcPc5iDubWUDZljpVfULXg/Jt6EUR+AS7PBisSTkRBE2G/Us+QlyLAEaAb BeNSYsAjuGtHQ9txA4lrsu6mXOEevlmXct+dqfRjVSBO1rSZKI3BOhA9OYTqUBdWKaOK LUpyE+oY2uFXnbCm+dsjIeKAOv0czEToCmrJJNYooSq8vkKPTOTxKTo+2H9eD/iwfE9h 6+65f0Wy+kok3X+bU+sN0alaka7G91jTiHiBlp5AgcQmwQCP+1IDZpwfFCnpRbGdZu6B A0Zp7jsYn6tkuz2KUcKrtqlBYEZVQzbSvrv9MCz7DvjNSTHsbcZdRAAG/Pune4/ogBJj 1lbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a+3zTTr6; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb41-20020a1709071ca900b00711da98d1besi14551518ejc.251.2022.06.20.02.20.33; Mon, 20 Jun 2022 02:20:59 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=a+3zTTr6; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239833AbiFTIyy (ORCPT + 99 others); Mon, 20 Jun 2022 04:54:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239308AbiFTIyw (ORCPT ); Mon, 20 Jun 2022 04:54:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 77290B1F for ; Mon, 20 Jun 2022 01:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655715290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=tK/eeW1pWNOA//wEcdfUutwvJ2rc5cXMd97zpjA0M+4=; b=a+3zTTr6MTrKJoD1H4I4OxqVShpSV1uz+MNbNIrfSrvjjmsBuGPU+hM47RX+7af8U3VIUc 5mqlQZJ6nPoBVQcgUG45hN/blWoT6w2fV4gB6eRyPt08rcYzmzkbnFWzMe5h4h6fCJ/CGX biwI17IPF85NDOvDnkrb4W//HKAJjlM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-6-_ftH40seO0WtuyAGUR1exA-1; Mon, 20 Jun 2022 04:54:39 -0400 X-MC-Unique: _ftH40seO0WtuyAGUR1exA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A08929ABA38; Mon, 20 Jun 2022 08:54:39 +0000 (UTC) Received: from fedora-t480.redhat.com (unknown [10.67.24.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8DC19D5F; Mon, 20 Jun 2022 08:54:33 +0000 (UTC) From: Kate Hsuan To: Hans de Goede , Larry Finger , Phillip Potter , Greg Kroah-Hartman , Michael Straube , "Fabio M . De Francesco" , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Kate Hsuan Subject: [PATCH v1] staging: r8188eu: an incorrect return value made the function always return fail Date: Mon, 20 Jun 2022 16:54:13 +0800 Message-Id: <20220620085413.948265-1-hpa@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,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 Since _SUCCESS (1) and _FAIL (0) are used to indicate the status of the functions. The previous commit 8ae7bf782eacad803f752c83a183393b0a67127b fixed and prevented dereferencing a NULL pointer through checking the return pointer. The NULL pointer check work properly but the return values (-ENOMEM on fail and 0 on success). This work fixed the return values to make sure the caller function will return the correct status. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2097526 Signed-off-by: Kate Hsuan --- drivers/staging/r8188eu/core/rtw_xmit.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index f4e9f6102539..2f8720db21d9 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -180,10 +180,8 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) pxmitpriv->free_xmit_extbuf_cnt = num_xmit_extbuf; res = rtw_alloc_hwxmits(padapter); - if (res) { - res = _FAIL; + if (res == _FAIL) goto exit; - } rtw_init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry); @@ -1510,7 +1508,7 @@ int rtw_alloc_hwxmits(struct adapter *padapter) pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry, GFP_KERNEL); if (!pxmitpriv->hwxmits) - return -ENOMEM; + return _FAIL; hwxmits = pxmitpriv->hwxmits; @@ -1528,7 +1526,7 @@ int rtw_alloc_hwxmits(struct adapter *padapter) } else { } - return 0; + return _SUCCESS; } void rtw_free_hwxmits(struct adapter *padapter) -- 2.36.1