diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2020-11-10 10:01:19 +0100 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2020-11-10 10:38:16 +0100 |
commit | a3230bd79ca4d266c45a0cc8cdef6a38a113797a (patch) | |
tree | a3c254aac4210af5cdbdd8603006424842a8060b /drivers/gpu/drm | |
parent | f9bd00e0ea9d9b04140aa969a9a13ad3597a1e4e (diff) |
drm/fb_helper: Use min_t() to handle size_t and unsigned long
On arm32:
drivers/gpu/drm/drm_fb_helper.c: In function ‘fb_read_screen_base’:
include/linux/minmax.h:18:28: warning: comparison of distinct pointer types lacks a cast
...
drivers/gpu/drm/drm_fb_helper.c:2041:22: note: in expansion of macro ‘min’
2041 | size_t alloc_size = min(count, PAGE_SIZE);
| ^~~
drivers/gpu/drm/drm_fb_helper.c: In function ‘fb_write_screen_base’:
include/linux/minmax.h:18:28: warning: comparison of distinct pointer types lacks a cast
...
drivers/gpu/drm/drm_fb_helper.c:2115:22: note: in expansion of macro ‘min’
2115 | size_t alloc_size = min(count, PAGE_SIZE);
| ^~~
Indeed, on 32-bit size_t is "unsigned int", not "unsigned long".
Fixes: 222ec45f4c69dfa8 ("drm/fb_helper: Support framebuffers in I/O memory")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201110090119.2667326-1-geert+renesas@glider.be
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/drm_fb_helper.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 01ba1da28511..25edf670867c 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -2038,7 +2038,7 @@ static ssize_t fb_read_screen_base(struct fb_info *info, char __user *buf, size_ loff_t pos) { const char __iomem *src = info->screen_base + pos; - size_t alloc_size = min(count, PAGE_SIZE); + size_t alloc_size = min_t(size_t, count, PAGE_SIZE); ssize_t ret = 0; int err = 0; char *tmp; @@ -2112,7 +2112,7 @@ static ssize_t fb_write_screen_base(struct fb_info *info, const char __user *buf loff_t pos) { char __iomem *dst = info->screen_base + pos; - size_t alloc_size = min(count, PAGE_SIZE); + size_t alloc_size = min_t(size_t, count, PAGE_SIZE); ssize_t ret = 0; int err = 0; u8 *tmp; |