From: Mitchel Humpherys <mitchelh@codeaurora.org>
To: Colin Cross <ccross@android.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
devel@linuxdriverproject.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Android Kernel Team <kernel-team@android.com>,
John Stultz <john.stultz@linaro.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] staging: ion: chunk_heap: use %pad for printing dma_addr_t's
Date: Mon, 04 May 2015 22:59:39 -0700 [thread overview]
Message-ID: <vnkwsibb4l9w.fsf@mitchelh-linux1.qualcomm.com> (raw)
In-Reply-To: <CAMbhsRQ7W2huyOX5FDj5_6Kiv7LTXUQE1p_MeOHbfq1P9Y+KGA@mail.gmail.com> (Colin Cross's message of "Mon, 4 May 2015 13:05:50 -0700")
On Mon, May 04 2015 at 01:05:50 PM, Colin Cross <ccross@android.com> wrote:
> On Mon, May 4, 2015 at 1:22 AM, Dan Carpenter <dan.carpenter@oracle.com> 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 <mitchelh@codeaurora.org>
>>
>> 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
next prev parent reply other threads:[~2015-05-05 5:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 1:10 [PATCH v2 1/2] staging: ion: chunk_heap: use pr_debug for heap creation print Mitchel Humpherys
2015-04-10 1:10 ` [PATCH v2 2/2] staging: ion: chunk_heap: use %pad for printing dma_addr_t's Mitchel Humpherys
2015-05-04 8:22 ` Dan Carpenter
2015-05-04 20:05 ` Colin Cross
2015-05-05 5:59 ` Mitchel Humpherys [this message]
2015-05-08 7:26 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vnkwsibb4l9w.fsf@mitchelh-linux1.qualcomm.com \
--to=mitchelh@codeaurora.org \
--cc=ccross@android.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox