From: Thomas Zimmermann <tzimmermann@suse.de>
To: javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
dri-devel@lists.freedesktop.org,
kernel test robot <lkp@intel.com>
Subject: [PATCH 2/2] drm/ofdrm: Cast error pointers to void __iomem *
Date: Thu, 27 Oct 2022 13:57:07 +0200 [thread overview]
Message-ID: <20221027115707.17980-3-tzimmermann@suse.de> (raw)
In-Reply-To: <20221027115707.17980-1-tzimmermann@suse.de>
Cast error pointers when returning them as void __iomem *. Fixes
a number of Sparse warnings, such as the ones shown below.
../drivers/gpu/drm/tiny/ofdrm.c:439:31: warning: incorrect type in return expression (different address spaces)
../drivers/gpu/drm/tiny/ofdrm.c:439:31: expected void [noderef] __iomem *
../drivers/gpu/drm/tiny/ofdrm.c:439:31: got void *
../drivers/gpu/drm/tiny/ofdrm.c:442:31: warning: incorrect type in return expression (different address spaces)
../drivers/gpu/drm/tiny/ofdrm.c:442:31: expected void [noderef] __iomem *
../drivers/gpu/drm/tiny/ofdrm.c:442:31: got void *
See [1] for the bug report.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/dri-devel/202210200016.yiQzPIy0-lkp@intel.com/ # [1]
---
drivers/gpu/drm/tiny/ofdrm.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/tiny/ofdrm.c b/drivers/gpu/drm/tiny/ofdrm.c
index 0da8b248ccc6e..b358da3840ad0 100644
--- a/drivers/gpu/drm/tiny/ofdrm.c
+++ b/drivers/gpu/drm/tiny/ofdrm.c
@@ -436,21 +436,21 @@ static void __iomem *get_cmap_address_of(struct ofdrm_device *odev, struct devic
if (!addr_p)
addr_p = of_get_address(of_node, bar_no, &max_size, &flags);
if (!addr_p)
- return ERR_PTR(-ENODEV);
+ return (void __iomem *)ERR_PTR(-ENODEV);
if ((flags & (IORESOURCE_IO | IORESOURCE_MEM)) == 0)
- return ERR_PTR(-ENODEV);
+ return (void __iomem *)ERR_PTR(-ENODEV);
if ((offset + size) >= max_size)
- return ERR_PTR(-ENODEV);
+ return (void __iomem *)ERR_PTR(-ENODEV);
address = of_translate_address(of_node, addr_p);
if (address == OF_BAD_ADDR)
- return ERR_PTR(-ENODEV);
+ return (void __iomem *)ERR_PTR(-ENODEV);
mem = devm_ioremap(dev->dev, address + offset, size);
if (!mem)
- return ERR_PTR(-ENOMEM);
+ return (void __iomem *)ERR_PTR(-ENOMEM);
return mem;
}
@@ -468,7 +468,7 @@ static void __iomem *ofdrm_mach64_cmap_ioremap(struct ofdrm_device *odev,
cmap_base = devm_ioremap(dev->dev, address, 0x1000);
if (!cmap_base)
- return ERR_PTR(-ENOMEM);
+ return (void __iomem *)ERR_PTR(-ENOMEM);
return cmap_base;
}
@@ -627,11 +627,11 @@ static void __iomem *ofdrm_qemu_cmap_ioremap(struct ofdrm_device *odev,
address = of_translate_address(of_node, io_of_addr);
if (address == OF_BAD_ADDR)
- return ERR_PTR(-ENODEV);
+ return (void __iomem *)ERR_PTR(-ENODEV);
cmap_base = devm_ioremap(dev->dev, address + 0x3c8, 2);
if (!cmap_base)
- return ERR_PTR(-ENOMEM);
+ return (void __iomem *)ERR_PTR(-ENOMEM);
return cmap_base;
}
--
2.38.0
prev parent reply other threads:[~2022-10-27 11:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 11:57 [PATCH 0/2] drm/ofdrm: Fix sparse warnings Thomas Zimmermann
2022-10-27 11:57 ` [PATCH 1/2] drm/ofdrm: Cast PCI IDs to u32 for comparing Thomas Zimmermann
2022-10-27 13:07 ` Alexander Stein
2022-10-27 14:04 ` Thomas Zimmermann
2022-10-28 6:33 ` Alexander Stein
2022-10-28 6:59 ` Thomas Zimmermann
2022-10-27 11:57 ` Thomas Zimmermann [this message]
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=20221027115707.17980-3-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=lkp@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.