From patchwork Sun Jan 8 12:38:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Straube X-Patchwork-Id: 40495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1689198wrt; Sun, 8 Jan 2023 04:47:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXsTvisRcz7x2euC6FTQ2378uASLKuZdzJF5lT16zp588dGstHqghQqH6OTBA+FIysqqCuLC X-Received: by 2002:a05:6a00:e8d:b0:580:c223:90e9 with SMTP id bo13-20020a056a000e8d00b00580c22390e9mr53475008pfb.6.1673182051710; Sun, 08 Jan 2023 04:47:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673182051; cv=none; d=google.com; s=arc-20160816; b=RQ5kzbMqnIXZhkbdDC5c7Hfk6A3UAHt8HLlUegsgh/tdD4ug/xea2gaTM0KwSGnIea qBmp+wYhbt5eKPDG1Dcrv5CJMCHE186qozsnQPDMIljqlLGo+WFvhVU15NJCxWCgogrf uA+bb8pAtZHVC8DmSRivpXtbCZoIvDpmlXrq6QvsxDyXEoUSu0fqxR8MX5KhLlo8hMDC PK/v8fbL+KESWcuej/pbmPfas+hm9XNEeny5HWHkL7SYEaQ6D/fAnjLAnFYRehimnYOA 3zFAGYokKuweoP4YYtP+IvKGsYaFGoJFHQBmiMMVDHUeyMyIV38ukbAE8mVxTzVc2F7j rxvw== 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=Avq55gRD0o24gHHFPcHLu6HTKb28LUs31qoNXBnZq7o=; b=l8C+u/mQjOcS3LSoPUdAzWBodiKmPhE8yhGVhvGv28LJDCHEKeesmPB5KyepHGkUfr fVqd6y2wvjFDxZ+7EqF6dg2DiFovYD4YECX9DPNg2M0OSikglb4QVckxUv5M53hzzNSy iz7to1AZpEIXsIMj/5Qe57zUjHcpRmrpQEKBH2/i7AYfOwo0LwcIi4FpdaZKdVZ2GbDR yAZ+hByhwn/4ZaKPsdpS1bH5bPijkMiZRiAj1/CekeCydHfaTbWBqwSZRebEsTzndqMy xRyP+1jKZPBsntEgKaKZ/x/EBbfJ2N/IMNas0QS8nwDFQfb+FKyka/TAKIQtMtdZl42f WHPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SaRq11IR; 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 h19-20020a056a001a5300b005749d29f159si7408824pfv.194.2023.01.08.04.47.13; Sun, 08 Jan 2023 04:47:31 -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=SaRq11IR; 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 S230396AbjAHMiS (ORCPT + 99 others); Sun, 8 Jan 2023 07:38:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjAHMiR (ORCPT ); Sun, 8 Jan 2023 07:38:17 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE418A19C for ; Sun, 8 Jan 2023 04:38:15 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id cf18so7425190ejb.5 for ; Sun, 08 Jan 2023 04:38:15 -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=Avq55gRD0o24gHHFPcHLu6HTKb28LUs31qoNXBnZq7o=; b=SaRq11IRo9W5C99Bvfz6SYfn4HdsdfBFfQWi6NBPtPLz1Gb/qDzWd8WnqYPNs6llUr 35itgXqlGWAcRp7VZScT0IT73imvtXOVbNb/IRNKoo/VjnUrs/cv7IDScj6HiHeHhhoo svaX1tcRvBkyH5cGqT4STpAfINPyw9bCgHs7VuFbDNY5S2mq3mgmPKoAO7ZWL/E7HEAo 4BsM77RYm+0VkdKxeEu1SgwEhY0u1E7phyLx7BN7xcM6ucODYmql+tlOyhYMHNsEHWwD JteerpUUcLCY+W9M8LMp3GEj5el1F7EpTPYpmiA2Hw2VaonVv7IE7yKISSEyTY0TUsoS Dnkw== 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=Avq55gRD0o24gHHFPcHLu6HTKb28LUs31qoNXBnZq7o=; b=UlSAsJZnUKS2HhzMJahFIj1tKDjvwHfxfu4V7y4TtH0T8pSz4fiimdM20eMjEOt1Bn V2bothWwdAzzifgIWNBbITjhgrCJOLTyg4Nk/0ydgv7fAxZpdumlmNb5Toe3vi2abmGf 32UQOGCXpUED/m9kbs2OJbxxhKgllN7NouavIUfQ7gkBMEd5euaxJqutXheuB9RA3nuV +gcL8Jf5EC8JXrxJeSILkfJXh7SrlSLXLfgjwIlE1GJK18ITJWlVX198DA0GnpK3bBy9 7jg+39BUmqJ+27dCx05dqvXfQe6WiyUV+2Qb+smXqSIzVldeDqfudzjxFho0uxjUzkKd jdSQ== X-Gm-Message-State: AFqh2kq6WNYJaXiZxVoEtu0Pz787TeUM5KQ9WfKEEjnqo7pjo++NKvPY vsUoYie0ocwSVQw/3HpgJK8= X-Received: by 2002:a17:906:71c3:b0:7c0:dd80:e95e with SMTP id i3-20020a17090671c300b007c0dd80e95emr59081397ejk.51.1673181494346; Sun, 08 Jan 2023 04:38:14 -0800 (PST) Received: from localhost.localdomain (ip5f5abbc8.dynamic.kabel-deutschland.de. [95.90.187.200]) by smtp.gmail.com with ESMTPSA id e15-20020a170906c00f00b0084ca4bd71b8sm2448014ejz.208.2023.01.08.04.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 04:38:14 -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: convert rtw_writeN() to common error logic Date: Sun, 8 Jan 2023 13:38:04 +0100 Message-Id: <20230108123804.3754-1-straube.linux@gmail.com> X-Mailer: git-send-email 2.39.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?1754458543028435360?= X-GMAIL-MSGID: =?utf-8?q?1754458543028435360?= Convert the function rtw_writeN() away from returning _FAIL or _SUCCESS which uses inverted error logic. Use the common error logic instead. Return 0 for success and negative values for failure. Signed-off-by: Michael Straube Tested-by: Philipp Hortmann # Edimax N150 --- Tested on x86_64 with Inter-Tech DMG-02. drivers/staging/r8188eu/core/rtw_fw.c | 10 ++++------ drivers/staging/r8188eu/hal/usb_ops_linux.c | 7 ++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188eu/core/rtw_fw.c index 682c65b1e04c..1e4baf74ecd5 100644 --- a/drivers/staging/r8188eu/core/rtw_fw.c +++ b/drivers/staging/r8188eu/core/rtw_fw.c @@ -89,9 +89,8 @@ static int block_write(struct adapter *padapter, u8 *buffer, u32 size) addr = FW_8188E_START_ADDRESS + i * block_size; data = buffer + i * block_size; - ret = rtw_writeN(padapter, addr, block_size, data); - if (ret == _FAIL) - goto exit; + if (rtw_writeN(padapter, addr, block_size, data)) + return _FAIL; } if (remain) { @@ -105,9 +104,8 @@ static int block_write(struct adapter *padapter, u8 *buffer, u32 size) addr = FW_8188E_START_ADDRESS + offset + i * block_size; data = buffer + offset + i * block_size; - ret = rtw_writeN(padapter, addr, block_size, data); - if (ret == _FAIL) - goto exit; + if (rtw_writeN(padapter, addr, block_size, data)) + return _FAIL; } } diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 7c72f5e04d9b..f02f8568cdcf 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -179,14 +179,11 @@ int rtw_writeN(struct adapter *adapter, u32 addr, u32 length, u8 *data) struct io_priv *io_priv = &adapter->iopriv; struct intf_hdl *intf = &io_priv->intf; u16 value = addr & 0xffff; - int ret; if (length > VENDOR_CMD_MAX_DATA_LEN) - return _FAIL; + return -EINVAL; - ret = usb_write(intf, value, data, length); - - return RTW_STATUS_CODE(ret); + return usb_write(intf, value, data, length); } static void handle_txrpt_ccx_88e(struct adapter *adapter, u8 *buf)