From patchwork Fri May 14 10:00:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 438829 Delivered-To: patch@linaro.org Received: by 2002:a02:b78d:0:0:0:0:0 with SMTP id f13csp193062jam; Fri, 14 May 2021 03:04:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfwRAHnf/og47qqEbfvdjf5CUK8gethy2krhZgOpGh7RF0dz09kDbzj73DSVxvnjzluf2s X-Received: by 2002:a05:6602:18:: with SMTP id b24mr34062746ioa.1.1620986699200; Fri, 14 May 2021 03:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620986699; cv=none; d=google.com; s=arc-20160816; b=fDwwf7loIu7vBhskrE6ZVC7x0XGBP4x3l88V2ZzrwqctIvqBm32GdgKomzv+t0YOsx ft6BYvBQSmWRhQkgBU1FXg0wvr7RoB4DJKz3tOpE7ERhB7wNG7b6a/kOPvymXw05FoyV WrwNGn5hkpOGoFVIGg+YCJ6Q9r9+ZqQlGdIB6oy1tohLIeb9rycYlmevQK0rRn7MAvWW dHx/5v5uTiKHZLXP9KtnartqB7FsHdCI/bqmIrSvz6A4AN+u0frS5xfrMoCduOByadP5 d3TZRB+rFDfmseuKNNrv8+HQlSqXr60LsEGVeynYXU76DOdXABc/ghFz3VPWIxGhiubu TyiQ== 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=LzwdQ5t6iXTf1QZolS8MwS92KYTFlqXLNTha54sIsfcoWG11OvR6BDeDmX72POD+EX h6apwmYYu9BFqI1qVYf+eINnjisvZDNiVt059Ww8wS4ILrWDEv4Ldu9Ul4ToSsUDqdcJ NxWL0S0aTEyTrRyTE2A5aCsGxJe/DF8H1NLI+tFgGTj6HhjnwkeVtZlGMR/6aydVj4Gy D74jmWkw3YAyREx39g5F+4GQq3ScPSoS6OfEnasJseIk1udyMBunJ+aiszhEmK2RkNba HV/YhI0KxC2pdNX/8OxF4et9lfEYKWoN45zXY3dmFM19trzzQh7zU1V1PbImVcqYc7Gd dSOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iMFORgVv; 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 i13si8425288ilm.45.2021.05.14.03.04.59; Fri, 14 May 2021 03:04:59 -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=iMFORgVv; 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 S233935AbhENKGG (ORCPT + 2 others); Fri, 14 May 2021 06:06:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:59878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233095AbhENKGB (ORCPT ); Fri, 14 May 2021 06:06:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9E00461451; Fri, 14 May 2021 10:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620986690; bh=Z8/t58HXrQWvRNq7RJkw/zVGS+awX9fu5iAau4CEuTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iMFORgVvpUam5l1Ot5WAFAEdgQ6hOWylryRauPWqLSM9oyPVkSljtnfsp/tRLqts7 x1rivjkt8EjbhW/aipO0alcOfrFjzx+xSiB77wNyk5lkjq/iHNe6J2XZmA2uNgD99O Z4JieUdSSp34tMB49wHV2NvgIR4jRfuRwudTyu/+7OgSFkTtyKN0DA6ju5r0F9SrdD fu7s2OLdk+DKsHYxI4FTheOl17iZ5pV/TBH5LDFcinKYuncpC9GQKysvTEuxpZHWmF +/7JnHdLJzsOWGZc9wDHc8mXYOb2d7XF5Cf6KRSdBVofjwhBXAUoxLh6jaF1vgFuXK 8VzxZxEm6yIYQ== 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: [PATCH v2 10/13] mwifiex: re-fix for unaligned accesses Date: Fri, 14 May 2021 12:00:58 +0200 Message-Id: <20210514100106.3404011-11-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210514100106.3404011-1-arnd@kernel.org> References: <20210514100106.3404011-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 Acked-by: Kalle Valo 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; }