From patchwork Fri May 7 22:07:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 432148 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp704863jao; Fri, 7 May 2021 15:11:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuA0+deceik9V9j2HYrF3dM2tX3l7Ni0tRlBW0Pj4RCwbiaH9JuzrOKwOrmSm92S6H1ke9 X-Received: by 2002:a17:906:e84:: with SMTP id p4mr12439386ejf.248.1620425512698; Fri, 07 May 2021 15:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620425512; cv=none; d=google.com; s=arc-20160816; b=pE9Z9vENRQ33Rfvxi+vORZKzrOYMm7t0cQB5v7hdg7Im2bY87k7W8P6R9YukofQOFA q6YsX23D2arbNYRImJgILZlH/fPqDZuvo+TzoGOsbKO58qbl1vV/nW7b/XGxIsiGJa1t ozgI42oYkJqVI1v0JvO4XFJhvZHb/zFOyn1cpCMgVR1qEvxMQCpQOjI3YAmJ3cbRwsa2 BWU3paQMK1P/E8hPEuByN0CvbXMWR3c0G4iM4h5MszDXLIKYFOMzPg6FJInFRUXMhI2b lIAIO/SP6qfg9L9Dp6Ah9S9DRvwb67ts9704ZB/Fxtlx/4mLbjTptiEb22+1mh/S3WAc +S7Q== 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 :dkim-signature; bh=uDNzPXGLZIDBuiyEvWzi6wm3Ec4uI0Xf3NIn6VH1b+M=; b=R6DvSf56UK4J6rG3dTBOWR7v1utQI+fCIiNDTPFu3Uq7wHhY1xYhjHQcEB+VDuG5Sd bHi9ZkDNFPyGLAOmqEDAGd2X477G79OiXI1tjrf3XW3ITOkI0YeDcZCtY/x/YJkzQ0LX CEG3eJaebjTgZmwSTZNHM/+hha1/yQnYY0yYQo/fiVQp5p3YYqoD6xHanliTowJHhcBd 3R68rKFbunLQ6IUhbnRiJ161TdNvUAiPC1j/ruwV8VDqyqoty7CHWNaU0p9hAAw7i3qf exSyUNqFkvb2yMUecQ8pIBdb4vEQN8v4FdbL6cVThmPbgUmUeTt/ks0FzHMMUhwiswxI QCXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IijVFH2E; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d23si5238892eja.469.2021.05.07.15.11.52; Fri, 07 May 2021 15:11:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IijVFH2E; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230097AbhEGWMr (ORCPT + 2 others); Fri, 7 May 2021 18:12:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:59358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230095AbhEGWMo (ORCPT ); Fri, 7 May 2021 18:12:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5D8BA611F1; Fri, 7 May 2021 22:11:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620425504; bh=Z8/t58HXrQWvRNq7RJkw/zVGS+awX9fu5iAau4CEuTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IijVFH2E9HYV114Qph7UNhwrB8O6u0uJ75WgEB1kdGOOsojWG6SZI+w7aO7Du9pPZ i4wK5qDqL+Xg2c21IF+rtS2QP3M2fu8X03aK/XJ12T/920xgeSeS2f+uPfu8VTspBA d2PzThH7iDrvRAxgXCxZ6o9UKux7qVqMfgAwNxAKh3MdEISscybroj31bgsXukMScx 7S9iS8iUIgMXaWvsviiBYmzG8Zdl090OJV4U1xSUstAaENoNFmJHMz5aXxfr3GuGq0 /hXveixaY+1ncEEFO4kj7NAMBeNz1AJEZ6QF1pjHpVQJb3xg1XGHRrx19/rGbv01hb 0u2ivoBCHBxgA== From: Arnd Bergmann To: linux-arch@vger.kernel.org Cc: Linus Torvalds , Vineet Gupta , Arnd Bergmann , Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Kalle Valo , "David S. Miller" , Jakub Kicinski , Devidas Puranik , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 10/12] mwifiex: re-fix for unaligned accesses Date: Sat, 8 May 2021 00:07:55 +0200 Message-Id: <20210507220813.365382-11-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210507220813.365382-1-arnd@kernel.org> References: <20210507220813.365382-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Arnd Bergmann A patch from 2017 changed some accesses to DMA memory to use get_unaligned_le32() and similar interfaces, to avoid problems with doing unaligned accesson uncached memory. However, the change in the mwifiex_pcie_alloc_sleep_cookie_buf() function ended up changing the size of the access instead, as it operates on a pointer to u8. Change this function back to actually access the entire 32 bits. Note that the pointer is aligned by definition because it came from dma_alloc_coherent(). Fixes: 92c70a958b0b ("mwifiex: fix for unaligned reads") Signed-off-by: Arnd Bergmann --- drivers/net/wireless/marvell/mwifiex/pcie.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.29.2 diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 94228b316df1..46517515ba72 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -1231,7 +1231,7 @@ static int mwifiex_pcie_delete_cmdrsp_buf(struct mwifiex_adapter *adapter) static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) { struct pcie_service_card *card = adapter->card; - u32 tmp; + u32 *cookie; card->sleep_cookie_vbase = dma_alloc_coherent(&card->dev->dev, sizeof(u32), @@ -1242,13 +1242,11 @@ static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) "dma_alloc_coherent failed!\n"); return -ENOMEM; } + cookie = (u32 *)card->sleep_cookie_vbase; /* Init val of Sleep Cookie */ - tmp = FW_AWAKE_COOKIE; - put_unaligned(tmp, card->sleep_cookie_vbase); + *cookie = FW_AWAKE_COOKIE; - mwifiex_dbg(adapter, INFO, - "alloc_scook: sleep cookie=0x%x\n", - get_unaligned(card->sleep_cookie_vbase)); + mwifiex_dbg(adapter, INFO, "alloc_scook: sleep cookie=0x%x\n", *cookie); return 0; }