2017-06-20 04:55:54

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] drm: sti: sti_hqvdp: Fix compilation warning.

Replace '%d' by '%zu' and '%lu' to fix the following compilation warning:-

drivers/gpu/drm/sti/sti_hqvdp.c: In function ‘sti_hqvdp_start_xp70’:
drivers/gpu/drm/sti/sti_hqvdp.c:925:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat=]
DRM_ERROR("Invalid firmware size (%d)\n", firmware->size);
^
drivers/gpu/drm/sti/sti_hqvdp.c:930:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
DRM_ERROR("Invalid fmw structure (%d+%d+%d+%d+%d != %d)\n",
^
drivers/gpu/drm/sti/sti_hqvdp.c:930:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 9 has type ‘size_t’ [-Wformat=]

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/gpu/drm/sti/sti_hqvdp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index 66f8431..267d816 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -922,12 +922,12 @@ static void sti_hqvdp_start_xp70(struct sti_hqvdp *hqvdp)

header = (struct fw_header *)firmware->data;
if (firmware->size < sizeof(*header)) {
- DRM_ERROR("Invalid firmware size (%d)\n", firmware->size);
+ DRM_ERROR("Invalid firmware size (%zu)\n", firmware->size);
goto out;
}
if ((sizeof(*header) + header->rd_size + header->wr_size +
header->pmem_size + header->dmem_size) != firmware->size) {
- DRM_ERROR("Invalid fmw structure (%d+%d+%d+%d+%d != %d)\n",
+ DRM_ERROR("Invalid fmw structure (%lu+%d+%d+%d+%d != %zu)\n",
sizeof(*header), header->rd_size, header->wr_size,
header->pmem_size, header->dmem_size,
firmware->size);
--
1.9.1


2017-06-20 11:29:17

by Benjamin Gaignard

[permalink] [raw]
Subject: Re: [PATCH] drm: sti: sti_hqvdp: Fix compilation warning.

2017-06-20 6:55 GMT+02:00 Arvind Yadav <[email protected]>:
> Replace '%d' by '%zu' and '%lu' to fix the following compilation warning:-
>
> drivers/gpu/drm/sti/sti_hqvdp.c: In function ‘sti_hqvdp_start_xp70’:
> drivers/gpu/drm/sti/sti_hqvdp.c:925:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat=]
> DRM_ERROR("Invalid firmware size (%d)\n", firmware->size);
> ^
> drivers/gpu/drm/sti/sti_hqvdp.c:930:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
> DRM_ERROR("Invalid fmw structure (%d+%d+%d+%d+%d != %d)\n",
> ^
> drivers/gpu/drm/sti/sti_hqvdp.c:930:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 9 has type ‘size_t’ [-Wformat=]

I do not manage to reproduce the warnings on my side so I will merge
this patch yet.

Regards
Benjamin

>
> Signed-off-by: Arvind Yadav <[email protected]>
> ---
> drivers/gpu/drm/sti/sti_hqvdp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index 66f8431..267d816 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -922,12 +922,12 @@ static void sti_hqvdp_start_xp70(struct sti_hqvdp *hqvdp)
>
> header = (struct fw_header *)firmware->data;
> if (firmware->size < sizeof(*header)) {
> - DRM_ERROR("Invalid firmware size (%d)\n", firmware->size);
> + DRM_ERROR("Invalid firmware size (%zu)\n", firmware->size);
> goto out;
> }
> if ((sizeof(*header) + header->rd_size + header->wr_size +
> header->pmem_size + header->dmem_size) != firmware->size) {
> - DRM_ERROR("Invalid fmw structure (%d+%d+%d+%d+%d != %d)\n",
> + DRM_ERROR("Invalid fmw structure (%lu+%d+%d+%d+%d != %zu)\n",
> sizeof(*header), header->rd_size, header->wr_size,
> header->pmem_size, header->dmem_size,
> firmware->size);
> --
> 1.9.1
>

2017-06-20 11:55:52

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] drm: sti: sti_hqvdp: Fix compilation warning.

Hi Arvind,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.12-rc6 next-20170620]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Arvind-Yadav/drm-sti-sti_hqvdp-Fix-compilation-warning/20170620-170709
base: git://people.freedesktop.org/~airlied/linux.git drm-next
config: arm-multi_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All warnings (new ones prefixed by >>):

In file included from include/drm/drm_gem_cma_helper.h:4:0,
from drivers/gpu/drm/sti/sti_hqvdp.c:14:
drivers/gpu/drm/sti/sti_hqvdp.c: In function 'sti_hqvdp_start_xp70':
>> drivers/gpu/drm/sti/sti_hqvdp.c:929:13: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
DRM_ERROR("Invalid fmw structure (%lu+%d+%d+%d+%d != %zu)\n",
^
include/drm/drmP.h:187:36: note: in definition of macro 'DRM_ERROR'
drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)
^~~

vim +929 drivers/gpu/drm/sti/sti_hqvdp.c

913 return;
914 }
915
916 /* Check firmware parts */
917 if (!firmware) {
918 DRM_ERROR("Firmware not available\n");
919 return;
920 }
921
922 header = (struct fw_header *)firmware->data;
923 if (firmware->size < sizeof(*header)) {
924 DRM_ERROR("Invalid firmware size (%zu)\n", firmware->size);
925 goto out;
926 }
927 if ((sizeof(*header) + header->rd_size + header->wr_size +
928 header->pmem_size + header->dmem_size) != firmware->size) {
> 929 DRM_ERROR("Invalid fmw structure (%lu+%d+%d+%d+%d != %zu)\n",
930 sizeof(*header), header->rd_size, header->wr_size,
931 header->pmem_size, header->dmem_size,
932 firmware->size);
933 goto out;
934 }
935
936 data = (u8 *)firmware->data;
937 data += sizeof(*header);

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (2.38 kB)
.config.gz (40.37 kB)
Download all attachments