Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1854599pxa; Sat, 29 Aug 2020 05:47:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5XC2r3bxetr1N+kenR0BzxAPJXyVzUewJJmpGW8z3nL9diuY89Sps8Fh+jKnFR1S/7RKM X-Received: by 2002:a05:6402:a51:: with SMTP id bt17mr3225832edb.382.1598705226073; Sat, 29 Aug 2020 05:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598705226; cv=none; d=google.com; s=arc-20160816; b=J8lVx+L9nNv0nPpN15uIiftr6Ki1UH7FovFb9SBXcHuAyL8D2ajggkjdaLfWcFC5W4 dZDlQRbFv2CCvyKGmFKTBHiGsMZgwAz4HLfPlwplQ9Zeaty5c0EwUAOgvsIFp2SCgEiq oDYjSSBvXO6gLRV+3v0gpCZM14crFk+OmQ87OalrTTYtA1bOwcH26DuSjQ8OsHR2nSEJ Xp4wi1//vAqIdgNHiC8hR/+zCW3QUKfHynbO6LhXqMRcub6fomy4THRDnxzk0jHBIpkI yO8VneV8Z036qu2i+oX9gU+G+N3WbEm7SEQaUcOmtZjOFDCY54xbivJdjq+Uv5ddnKWh IkJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zT1kQRAGRqilf//ibtfeCmY0vNPQuWGrGElhqPXv0mo=; b=HA41tdWZkA0uaZ+yoGIE214Prdh2Yzghqz+WC/94Ps5dk6DtFVEDaKlzSKXfLk0tmw GDI5+YGW9vZjSJ6nUsRzjJ5k5PmggPf/1VQR8wqGUqe36T7g742e9x6IegexJZOU0NuY GJ47TVClsWtu5KwwOs9FgSRx/pM3MRYOxLs/qaTxGncUQ2eRmc090q0VfqdZMLImMr3M ebltqVg/Yq+e/6mxisZzd0pRQ8JmppFi8NkKndUA342M0u70cRPfGk9K1p3nQcxIV/pW eXQ2kRmXmFGFMHn7fvA/V+aAWDCrqLqVvs54H5OQdw7cVgR3Pm7onU4UBhYvOpTAQ+F4 baqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e13si1693859ejd.36.2020.08.29.05.46.43; Sat, 29 Aug 2020 05:47:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727923AbgH2Mpr (ORCPT + 99 others); Sat, 29 Aug 2020 08:45:47 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:36272 "EHLO fornost.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727772AbgH2Mpo (ORCPT ); Sat, 29 Aug 2020 08:45:44 -0400 Received: from gwarestrin.arnor.me.apana.org.au ([192.168.0.7]) by fornost.hmeau.com with smtp (Exim 4.92 #5 (Debian)) id 1kC0Eh-0006nT-R8; Sat, 29 Aug 2020 22:45:36 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Sat, 29 Aug 2020 22:45:35 +1000 Date: Sat, 29 Aug 2020 22:45:35 +1000 From: Herbert Xu To: Guenter Roeck Cc: Andrew Morton , Linus Torvalds , Linux Kernel Mailing List , Joerg Roedel , Luc Van Oostenryck , Wen He , Peng Ma , Vinod Koul Subject: [PATCH] dmaengine: fsldma: Do not pass pointers to lower_32_bits Message-ID: <20200829124535.GA11751@gondor.apana.org.au> References: <20200828071125.GA18772@gondor.apana.org.au> <20200829105116.GA246533@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200829105116.GA246533@roeck-us.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 29, 2020 at 03:51:16AM -0700, Guenter Roeck wrote: > > This patch results in the following compile error when compiling > ppc:mpc85xx_defconfig. > > Error log: > In file included from ./include/linux/list.h:9, > from ./include/linux/module.h:12, > from drivers/dma/fsldma.c:23: > drivers/dma/fsldma.h: In function 'fsl_ioread64': > ./include/linux/kernel.h:189:37: error: invalid operands to binary & (have 'const u64 *' {aka 'const long long unsigned int *'} and 'unsigned int') > 189 | #define lower_32_bits(n) ((u32)((n) & 0xffffffff)) > | ^ > drivers/dma/fsldma.h:208:17: note: in expansion of macro 'lower_32_bits' > 208 | u32 fsl_addr = lower_32_bits(addr); > | ^~~~~~~~~~~~~ > drivers/dma/fsldma.h: In function 'fsl_ioread64be': > ./include/linux/kernel.h:189:37: error: invalid operands to binary & (have 'const u64 *' {aka 'const long long unsigned int *'} and 'unsigned int') > 189 | #define lower_32_bits(n) ((u32)((n) & 0xffffffff)) > | ^ > drivers/dma/fsldma.h:222:17: note: in expansion of macro 'lower_32_bits' > 222 | u32 fsl_addr = lower_32_bits(addr); > | ^~~~~~~~~~~~~ > make[2]: *** [drivers/dma/fsldma.o] Error 1 Thanks for the report. Passing a pointer to lower_32_bits is just bad. ---8<--- The functions fsl_ioread64* were passing a pointer to lower_32_bits which just happened to work because it was a macro that simply did a cast on the argument. However, now that lower_32_bits does a mask on the argument it no longer works. Passing a pointer to lower_32_bits doesn't look right anyway. This patch adds explicit casts so that an integer is passed along as the argument to lower_32_bits. Reported-by: Guenter Roeck Signed-off-by: Herbert Xu diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index 56f18ae99233..da5816b1706e 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h @@ -205,7 +205,7 @@ struct fsldma_chan { #else static u64 fsl_ioread64(const u64 __iomem *addr) { - u32 fsl_addr = lower_32_bits(addr); + u32 fsl_addr = lower_32_bits((unsigned long)addr); u64 fsl_addr_hi = (u64)in_le32((u32 *)(fsl_addr + 1)) << 32; return fsl_addr_hi | in_le32((u32 *)fsl_addr); @@ -219,7 +219,7 @@ static void fsl_iowrite64(u64 val, u64 __iomem *addr) static u64 fsl_ioread64be(const u64 __iomem *addr) { - u32 fsl_addr = lower_32_bits(addr); + u32 fsl_addr = lower_32_bits((unsigned long)addr); u64 fsl_addr_hi = (u64)in_be32((u32 *)fsl_addr) << 32; return fsl_addr_hi | in_be32((u32 *)(fsl_addr + 1)); -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt