From nobody Mon Apr 27 01:52:25 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 217AEC43334 for ; Mon, 20 Jun 2022 08:54:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240036AbiFTIyz (ORCPT ); Mon, 20 Jun 2022 04:54:55 -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: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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=3D2097526 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/r818= 8eu/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, s= truct adapter *padapter) pxmitpriv->free_xmit_extbuf_cnt =3D num_xmit_extbuf; =20 res =3D rtw_alloc_hwxmits(padapter); - if (res) { - res =3D _FAIL; + if (res =3D=3D _FAIL) goto exit; - } =20 rtw_init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry); =20 @@ -1510,7 +1508,7 @@ int rtw_alloc_hwxmits(struct adapter *padapter) =20 pxmitpriv->hwxmits =3D kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit= _entry, GFP_KERNEL); if (!pxmitpriv->hwxmits) - return -ENOMEM; + return _FAIL; =20 hwxmits =3D pxmitpriv->hwxmits; =20 @@ -1528,7 +1526,7 @@ int rtw_alloc_hwxmits(struct adapter *padapter) } else { } =20 - return 0; + return _SUCCESS; } =20 void rtw_free_hwxmits(struct adapter *padapter) --=20 2.36.1