From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755216AbbEEF7u (ORCPT ); Tue, 5 May 2015 01:59:50 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50393 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752153AbbEEF7l (ORCPT ); Tue, 5 May 2015 01:59:41 -0400 From: Mitchel Humpherys To: Colin Cross Cc: Dan Carpenter , devel@linuxdriverproject.org, Greg Kroah-Hartman , Android Kernel Team , John Stultz , lkml Subject: Re: [PATCH v2 2/2] staging: ion: chunk_heap: use %pad for printing dma_addr_t's References: <1428628204-25752-1-git-send-email-mitchelh@codeaurora.org> <1428628204-25752-2-git-send-email-mitchelh@codeaurora.org> <20150504082250.GJ14154@mwanda> Date: Mon, 04 May 2015 22:59:39 -0700 In-Reply-To: (Colin Cross's message of "Mon, 4 May 2015 13:05:50 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 04 2015 at 01:05:50 PM, Colin Cross wrote: > On Mon, May 4, 2015 at 1:22 AM, Dan Carpenter wrote: >> On Thu, Apr 09, 2015 at 06:10:04PM -0700, Mitchel Humpherys wrote: >>> We're currently using %lu and %ld to print some variables of type >>> dma_addr_t, which results in the following warning when dma_addr_t is >>> 64-bits wide: >>> >>> drivers/staging/android/ion/ion_chunk_heap.c: In function 'ion_chunk_heap_create': >>> drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'dma_addr_t' [-Wformat=] >>> pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base, >>> ^ >>> drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'dma_addr_t' [-Wformat=] >>> >>> Fix this by using %pad as instructed in printk-formats.txt. >>> >>> Signed-off-by: Mitchel Humpherys >> >> This one was just merged and I was about to email you that it introduces >> some new Smatch warnings, but actually looking at it, it's just wrong. >> >> We want to print "chunk_heap->base" and not "&chunk_heap->base". > > This would be correct if base was a dma_addr_t... > >> And anyway "&chunk_heap->base" is a regular pointer, not a dma_addr_t. > > But it is actually an ion_phys_addr_t, which is currently typedef'd to > unsigned long. Are you using a local patch that replaces > ion_phys_addr_t with dma_addr_t? > >> So please send a new patch that removes the &. > > Removing the & is not correct, lib/vsprintf.c will dereference the arg > for %pad or %pap. I think this patch should just be dropped, the old > %lu was correct for what is in Linus' tree. Ah, you're absolutely correct. We have a local patch that makes ion_phys_addr_t a dma_addr_t (needed for LPAE), which is why I needed to convert the printk format... Greg, can you please drop this patch from your tree? We'll only need this if/when mainline Ion gets LPAE support... -Mitch -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project