From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "David E . Box" <david.e.box@linux.intel.com>,
Hans de Goede <hdegoede@redhat.com>,
platform-driver-x86@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"kernel test robot" <lkp@intel.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Dan Williams" <dan.j.williams@intel.com>
Subject: [PATCH 1/1] cleanup: Fix sparse complaining about passing iomem ptr to no_free_ptr()
Date: Tue, 26 Mar 2024 13:24:47 +0200 [thread overview]
Message-ID: <20240326112448.29332-1-ilpo.jarvinen@linux.intel.com> (raw)
Calling no_free_ptr() for an __iomem pointer results in sparse
complaining about the types:
sparse: warning: incorrect type in argument 1 (different address spaces)
sparse: expected void const volatile *val
sparse: got void [noderef] __iomem *__val
(The example from drivers/platform/x86/intel/pmc/core_ssram.c:277).
The problem is caused by the signature of __must_check_fn() added in
the commit 85be6d842447 ("cleanup: Make no_free_ptr() __must_check") to
enforce return value is always used.
Use __force to allow both iomem and non-iomem pointers to be given for
no_free_ptr().
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202403050547.qnZtuNlN-lkp@intel.com/
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
include/linux/cleanup.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/cleanup.h b/include/linux/cleanup.h
index c2d09bc4f976..4f4d709c3967 100644
--- a/include/linux/cleanup.h
+++ b/include/linux/cleanup.h
@@ -73,7 +73,7 @@ const volatile void * __must_check_fn(const volatile void *val)
{ return val; }
#define no_free_ptr(p) \
- ((typeof(p)) __must_check_fn(__get_and_null_ptr(p)))
+ ((typeof(p)) __must_check_fn((__force const volatile void *)__get_and_null_ptr(p)))
#define return_ptr(p) return no_free_ptr(p)
--
2.39.2
reply other threads:[~2024-03-26 11:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240326112448.29332-1-ilpo.jarvinen@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=david.e.box@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=peterz@infradead.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=torvalds@linux-foundation.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).