Received: by 2002:ab2:78c:0:b0:1ec:b906:25e5 with SMTP id h12csp255422lqe; Fri, 23 Feb 2024 03:36:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWlZg8/5za/+jKGbKkjphfdcGp/AQ4ijTlIWLIoaIqw9I5V8YUHlMYQalKLTBCoUZ2D22ywPtpYOzVVJHPO+ak6ytgKaxqCA2UTqcxukA== X-Google-Smtp-Source: AGHT+IF71VQsOjIM7vjJQpnxOzdkQXLtzU8nUj8rHq6NRGUOQy5IRohKShLepGmZvc21f4bIoUpL X-Received: by 2002:a05:6871:3a2c:b0:21e:80ee:523b with SMTP id pu44-20020a0568713a2c00b0021e80ee523bmr1710334oac.34.1708686492618; Fri, 23 Feb 2024 03:08:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708686492; cv=pass; d=google.com; s=arc-20160816; b=QUd5wvUxCldEn3/LcgvKcg7QOcF/z5dgGJ7C0AMWPA95M9/aHxIFQYfBs/rOAWGqYM sj4F1xMUAGcWZJ7trRuagbk/p14/kKSbVqCIVxAJCALnKo2JNzizlEzIQObhOru6AnES H6ZR34/phyOEp0N/NbQeR5r2W/HF98DCQ/8e0cd6Nl5Gcqy0UoT5AFfAlM8GCb75PenY 0jFXOMOlcwULs/o3nFiyufzIsasIb5WoQNVVUYgzPqFxvhuBwA1oZQZzRZMTLSvbayhS hJSWPtcy4ZV8FKmdJ6k14iUGqIlK6zx9CdVxC3zMdTbbPptEYRRXhHVSS6Cxsp4EdEnO TM5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ow0fXAtxRUDlHJo+9At4OEaoozXDVvfZl9dEjTbZsP8=; fh=g3BFBLrKoEPOekXbJY1C5OfQeXpUnYwWgHlrpZTouHE=; b=yfmMiV+3DvsDv/VvK7JzWjBEaeML41yd9v9Oh9Clg44klHCUerV1pXeOLnTdkRrPYw TixaTfo6Wk6uwFyWDJXkwByzc504xMu+h4AoBOaaAoz+35iT9rnev7Y3rRGin5z2+Hs6 MfWK9R58JgHawF+U7mLDhV4ffGnSqdiqaHrgr4bXsKni/mwCDM2V/bQaI6OoIG1zeBzn z5QuagpYhIEbm5jyAHDmZ7JieV6/wM+5AiulBbMeQgJxP6uAMcFFxCsZpmP/xhVUsg/5 JHEYVKeYXSSNEcpM3I0se/K0mUxSa9NoRk+Zp0fzfKAEs30DQQdbf3IyaV4wLgnoLBW/ KB1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=vyv3+BjL; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-3959-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3959-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b22-20020a639316000000b005d9b49b7ad6si11783500pge.775.2024.02.23.03.08.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 03:08:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3959-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=vyv3+BjL; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-3959-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3959-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 594AEB20E15 for ; Fri, 23 Feb 2024 10:52:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20AB014B835; Fri, 23 Feb 2024 10:52:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="vyv3+BjL" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BA111428B for ; Fri, 23 Feb 2024 10:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708685542; cv=none; b=on9vz9TuiJH5eC0q+vKRkqxhuA7fbWVs335YGPyjGrvMEkwcHwrPMMZxqOsxHg6W4jjIdMr2m6kGF4m99iL0Aw7a7atZMJfkdp40mluwLuD689mtqGxlcQVy5fuilauQW9ZRZWNVm2syrRtstsbNBP8AAZcwdUS0wAz9lhgqnWg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708685542; c=relaxed/simple; bh=Q/4guf1NnvMjA0TFY6dFXf102kTk0SC9qLwejI1b+mQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=kqhLqQgR3wV9a2xyUfBvf7GY+bVEAVueSB/8/I9Uw9nPmvh3iYNXzJSgpx+xuZBygG7d3LPZN0MC+uKg0QACZ/kqLTkus3nlifNC97mPXNwQ4VHXWgqkuCv27FZ38PurIzIoVT5V/RnOTcQoLs2qolCtn2BR/jo6ymZi58jnQMs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=vyv3+BjL; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=ow0fXAtxRUDlHJo+9At4OEaoozXDVvfZl9dEjTbZsP8=; t=1708685540; x=1709895140; b=vyv3+BjLHKvCNqXYllcMJZkloqv+ec7goS62HXMm2XVbr0jid78b0vy/Pqsv2GLhNjk9z+tSRsb uc7Km0tSO8ls2Ne04khQ7JRyAtejzVFkP1S1uwwdvOxbje8wSbGQ9lvgLNBjHBw6tfgqw0NyVcnOM 1WFMppy5CyZgFYOL8bcqHxVjX6wj/FHooPdML5Geye/xsbWRtCpLZiQ4xLBCdWvrpuZZaHka3xica J+UR2PgE5fvIKRsC28GF+8GN+Fg6LznW646dYlps9FnafkmtDexXsMagL8bpeMFU5q93HHXjwaBuc m27dU2ixveYPDdnCvplL3gCDmwz/3EEZeDqw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rdTA8-000000052II-0Tnf; Fri, 23 Feb 2024 11:52:16 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Siva Rebbagondla , Johannes Berg Subject: [PATCH v2] wifi: rsi: fix endian conversions Date: Fri, 23 Feb 2024 11:52:14 +0100 Message-ID: <20240223115214.682fb94159fa.I576bbf9fe7ca2948dbe3e00c0fa0f37594e85046@changeid> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Johannes Berg This really seems like a bug, endian conversions now happen twice in this code. Note also that prior to the commit mentioned below, the code was putting 16-bit values 0xBBAA as bytes "AA BB 00 00", and the commit mentions making it work for 32-bit values and makes no mention of fixing endian conversion; however, after it, the bytes for 0xBBAA would now be "00 00 BB AA" on big endian platforms. Remove one conversion to make sparse no longer warn. Not sure anyone can, has, or ever will use this on big endian platforms though. Fixes: 0a60014b76f5 ("rsi: miscallaneous changes for 9116 and common") Signed-off-by: Johannes Berg --- drivers/net/wireless/rsi/rsi_91x_usb.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c index 10a465686439..0ce8c9aad1f1 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -222,7 +222,7 @@ static int rsi_usb_reg_write(struct usb_device *usbdev, u32 value, u16 len) { - u8 *usb_reg_buf; + __le32 *usb_reg_buf; int status = -ENOMEM; if (len > RSI_USB_CTRL_BUF_SIZE) @@ -232,17 +232,14 @@ static int rsi_usb_reg_write(struct usb_device *usbdev, if (!usb_reg_buf) return status; - usb_reg_buf[0] = (cpu_to_le32(value) & 0x00ff); - usb_reg_buf[1] = (cpu_to_le32(value) & 0xff00) >> 8; - usb_reg_buf[2] = (cpu_to_le32(value) & 0x00ff0000) >> 16; - usb_reg_buf[3] = (cpu_to_le32(value) & 0xff000000) >> 24; + usb_reg_buf[0] = cpu_to_le32(value); status = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), USB_VENDOR_REGISTER_WRITE, RSI_USB_REQ_OUT, - ((cpu_to_le32(reg) & 0xffff0000) >> 16), - (cpu_to_le32(reg) & 0xffff), + upper_16_bits(reg), + lower_16_bits(reg), (void *)usb_reg_buf, len, USB_CTRL_SET_TIMEOUT); -- 2.43.2