From patchwork Mon Feb 6 20:17:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 53498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2451552wrn; Mon, 6 Feb 2023 12:43:51 -0800 (PST) X-Google-Smtp-Source: AK7set8fx7S48UG3Mcijt5lARNXlwfMlJvqV67S58Yl+JfPUo8KufEAgp1OJASbKR8IOyMm9X8/V X-Received: by 2002:a17:906:1b09:b0:864:223:40b with SMTP id o9-20020a1709061b0900b008640223040bmr694546ejg.33.1675716231366; Mon, 06 Feb 2023 12:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675716231; cv=none; d=google.com; s=arc-20160816; b=BS7dHFtYjrXz9IswXKc0pEIExX70sScxGUZvqYd6AVuy6TnBn3fgl/9Evk0yNFOy+A KBSZrsc3DsuJoJbU0Fj08pq3/tH4+6ObLIkbvAk0eGwXK1HUlg9dqpCziuc4q7X1hkqy BrDhqFza5JZ93vfn59SMULMpv8P6L9CDISsJhLmOe0QiwUEpMxW77//uea0Bns9y968N iXrerwi8qlTlk8Pyf3h2AxgmMxuooDJE4nnnPg4J3l1oTb+3IOCYSK9rr1ZPmqHL4QC4 s2Tx/OxLItMrCnMVEuLAV8wBsj92nfZu6IM6IemQPyyZaZBg0L2Dn1F5yUyiDnIpUrTY dtVA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=OsGzdHu8gcfH/kKDopL7J2IxOLZabWqoV4D37eK7DMg=; b=F8vUA/5pI2PvJNVlkXfUAmFis2yvWM9jbGu7gOt7vn+4EHwpGA7JDENENko9z4rx7H JYdmZHGrr7g130WAhlylevXBxhkJVAu6/iE5DhgyfbMeAjtUK8Vhfel76Eyx/ScC6m+l w22GM4L72tWnPgkjXabS2dIwjeXAK2MxHzm1xv67k96uy4QTseH5BvsIbAd0vQm7uk4p Ucn/z9AEUK4atBBRLNjDEjVkSDA42ps3hUYFAgfbtyFaeJ4/VAWTQyfkbGGvGc5qx4Oh d6FWdKYZRGKRfVjfRdBLY8Qm1p6L8J3CB1JeFgPj/WkMkr6T8ZRgXWMbZ3UJsJ09RxEX +9+Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wi5-20020a170906fd4500b0088bf8e5331fsi11450410ejb.363.2023.02.06.12.43.28; Mon, 06 Feb 2023 12:43:51 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230132AbjBFUSk (ORCPT + 99 others); Mon, 6 Feb 2023 15:18:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbjBFUSe (ORCPT ); Mon, 6 Feb 2023 15:18:34 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4860F2942B for ; Mon, 6 Feb 2023 12:18:15 -0800 (PST) Received: from ipservice-092-217-084-033.092.217.pools.vodafone-ip.de ([92.217.84.33] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pP7wG-0007ps-Sf; Mon, 06 Feb 2023 21:18:08 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 2/6] staging: r8188eu: use standard error codes in rtw_read_port Date: Mon, 6 Feb 2023 21:17:56 +0100 Message-Id: <20230206201800.139195-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230206201800.139195-1-martin@kaiser.cx> References: <20230206201800.139195-1-martin@kaiser.cx> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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?1757115823183420194?= X-GMAIL-MSGID: =?utf-8?q?1757115823183420194?= Replace the driver-specific _SUCCESS and _FAIL error codes in rtw_read_port. Return 0 for success or a negative error code as we do elsewhere in the kernel. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/hal/usb_ops_linux.c | 13 ++++++------- drivers/staging/r8188eu/include/rtw_io.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 225a422ede4f..9611b19ab55b 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -406,7 +406,7 @@ static void usb_read_port_complete(struct urb *purb) } } -u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf) +int rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf) { struct urb *purb = NULL; struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter); @@ -416,13 +416,12 @@ u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf) unsigned int pipe; size_t tmpaddr = 0; size_t alignment = 0; - u32 ret = _SUCCESS; if (adapter->bDriverStopped || adapter->bSurpriseRemoved) - return _FAIL; + return -EPERM; if (!precvbuf) - return _FAIL; + return -ENOMEM; if (!precvbuf->reuse || !precvbuf->pskb) { precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue); @@ -434,7 +433,7 @@ u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf) if (!precvbuf->reuse || !precvbuf->pskb) { precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); if (!precvbuf->pskb) - return _FAIL; + return -ENOMEM; tmpaddr = (size_t)precvbuf->pskb->data; alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1); @@ -458,9 +457,9 @@ u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf) err = usb_submit_urb(purb, GFP_ATOMIC); if ((err) && (err != (-EPERM))) - ret = _FAIL; + return err; - return ret; + return 0; } void rtl8188eu_xmit_tasklet(unsigned long priv) diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r8188eu/include/rtw_io.h index 6b1de4f0e287..e1718f739cc9 100644 --- a/drivers/staging/r8188eu/include/rtw_io.h +++ b/drivers/staging/r8188eu/include/rtw_io.h @@ -19,7 +19,7 @@ int __must_check rtw_read8(struct adapter *adapter, u32 addr, u8 *data); int __must_check rtw_read16(struct adapter *adapter, u32 addr, u16 *data); int __must_check rtw_read32(struct adapter *adapter, u32 addr, u32 *data); -u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf); +int rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf); void rtw_read_port_cancel(struct adapter *adapter); int rtw_write8(struct adapter *adapter, u32 addr, u8 val);