staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning
PATCH 1/2 staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning
Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning
--- drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +1 -1
@@ -58,7 +58,7 @@ static void datadump(char *msg, void *m, int n)for (i =0 ; i < n; i++) {if ((i&0xf ) ==0 ) -pr_info (KERN_INFO "\n 0x%4x: " , i); +pr_info ("\n 0x%4x: " , i);pr_info ("%02X " , c[i]); }
Signature · 1 line
2.1.2
PATCH 2/2 staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
--- drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +2 -4
@@ -316,10 +316,8 @@ static int gs_fpgaboot(void)struct fpgaimage *fimage; fimage =kmalloc (sizeof (struct fpgaimage ),GFP_KERNEL ); -if (fimage ==NULL ) { -pr_err ("No memory is available\n" ); - goto err_out; - } +if (!fimage) +return -ENOMEM ; err =gs_load_image (fimage, file);if (err) {
Signature · 1 line
2.1.2
PATCH v2 1/2 staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning
Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning
--- drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +1 -1
@@ -58,7 +58,7 @@ static void datadump(char *msg, void *m, int n)for (i =0 ; i < n; i++) {if ((i&0xf ) ==0 ) -pr_info (KERN_INFO "\n 0x%4x: " , i); +pr_info ("\n 0x%4x: " , i);pr_info ("%02X " , c[i]); }
Signature · 1 line
2.1.2
PATCH v2 2/2 staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
--- drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +2 -5
@@ -316,10 +316,8 @@ static int gs_fpgaboot(void)struct fpgaimage *fimage; fimage =kmalloc (sizeof (struct fpgaimage ),GFP_KERNEL ); -if (fimage ==NULL ) { -pr_err ("No memory is available\n" ); - goto err_out; - } +if (!fimage) +return -ENOMEM ; err =gs_load_image (fimage, file);if (err) {
@@ -361,7 +359,6 @@ err_out2: err_out1:kfree (fimage); -err_out:return -1 ; }
Signature · 1 line
2.1.2
Quoted 1 line · Dzmitry Sledneu
Fix "Possible unnecessary
KERN_INFO" checkpatch.pl warning
[]
drivers/staging/gs_fpgaboot/gs_fpgaboot.c
Quoted 1 line
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +0
-0
[]
drivers/staging/gs_fpgaboot/gs_fpgaboot.c static void datadump(char *msg, void *m, int n) · line 64
Quoted 9 lines
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +1
-1@@ -58,7 +58,7 @@ static void datadump(char *msg, void *m, int n)for (i =0 ; i < n; i++) {if ((i&0xf ) ==0 ) -pr_info (KERN_INFO "\n 0x%4x: " , i); +pr_info ("\n 0x%4x: " , i);pr_info ("%02X " , c[i]); }
Please fix this by using print_hex_dump (and family) instead
Something like:
http://www.spinics.net/lists/linux-driver-devel/msg55075.html
PATCH v3 1/2 staging: gs_fpgaboot: Use print_hex_dump_bytes instead of pr_info
From: Joe Perches <[email protected]>
Use print_hex_dump_bytes instead of pr_info
--- drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-)
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +2 -23
@@ -46,27 +46,6 @@ static char *file = "xlinx_fpga_firmware.bit";module_param (file, charp,S_IRUGO );MODULE_PARM_DESC (file,"Xilinx FPGA firmware file." ); -#ifdef DEBUG_FPGA -static void datadump (char *msg,void *m,int n) -{ -int i; -unsigned char *c; - -pr_info ("=== %s ===\n" , msg); - - c = m; - -for (i =0 ; i < n; i++) { -if ((i&0xf ) ==0 ) -pr_info (KERN_INFO "\n 0x%4x: " , i); - -pr_info ("%02X " , c[i]); - } - -pr_info ("\n" ); -} -#endif /* DEBUG_FPGA */ -static void read_bitstream (char *bitdata,char *buf,int *offset,int rdsize) {memcpy (buf, bitdata + *offset, rdsize);
@@ -220,9 +199,9 @@ static int gs_download_image(struct fpgaimage *fimage, enum wbus bus_bytes) size = fimage->lendata;#ifdef DEBUG_FPGA -datadump ("bitfile sample" , bitdata,0x100 ); +print_hex_dump_bytes ("bitfile sample: " ,DUMP_PREFIX_OFFSET , + bitdata,0x100 );#endif /* DEBUG_FPGA */ -if (!xl_supported_prog_bus_width (bus_bytes)) {pr_err ("unsupported program bus width %d\n" , bus_bytes);
Signature · 1 line
2.1.2
PATCH v3 2/2 staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
--- drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +2 -5
@@ -295,10 +295,8 @@ static int gs_fpgaboot(void)struct fpgaimage *fimage; fimage =kmalloc (sizeof (struct fpgaimage ),GFP_KERNEL ); -if (fimage ==NULL ) { -pr_err ("No memory is available\n" ); - goto err_out; - } +if (!fimage) +return -ENOMEM ; err =gs_load_image (fimage, file);if (err) {
@@ -340,7 +338,6 @@ err_out2: err_out1:kfree (fimage); -err_out:return -1 ; }
Signature · 1 line
2.1.2
Greg Kroah-Hartman
maintainerRe: [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
Quoted 26 lines · Dzmitry Sledneu
Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
Signed-off-by Dzmitry Sledneu <[email protected]>--- drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/staging/gs_fpgaboot/gs_fpgaboot.c +2
-4@@ -295,10 +295,8 @@ static int gs_fpgaboot(void)struct fpgaimage *fimage; fimage =kmalloc (sizeof (struct fpgaimage ),GFP_KERNEL ); -if (fimage ==NULL ) { -pr_err ("No memory is available\n" ); - goto err_out; - } +if (!fimage) +return -ENOMEM ; err =gs_load_image (fimage, file);if (err) {
drivers/staging/gs_fpgaboot/gs_fpgaboot.c err_out2: · line 343
Quoted 7 lines
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +0
-1@@ -340,7 +338,6 @@ err_out2: err_out1:kfree (fimage); -err_out:return -1 ; }
Doesn't apply to my tree properly :(
Re: [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
Quoted 30 lines · Greg Kroah-Hartman
Quoted 29 lines · Dzmitry Sledneu
Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
Signed-off-by Dzmitry Sledneu <[email protected]>--- drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/staging/gs_fpgaboot/gs_fpgaboot.c +2
-4@@ -295,10 +295,8 @@ static int gs_fpgaboot(void)struct fpgaimage *fimage; fimage =kmalloc (sizeof (struct fpgaimage ),GFP_KERNEL ); -if (fimage ==NULL ) { -pr_err ("No memory is available\n" ); - goto err_out; - } +if (!fimage) +return -ENOMEM ; err =gs_load_image (fimage, file);if (err) {@@ -340,7 +338,6 @@ err_out2: err_out1:kfree (fimage);
Quoted 7 lines
drivers/staging/gs_fpgaboot/gs_fpgaboot.c err_out2: · line 343
Quoted 4 lines
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +0
-1-err_out:return -1 ; }Doesn't apply to my tree properly :(
I looked at it in your tree and it has already been fixed there.
But the fix is not quite correct, because it returns -ENOPERM (-1) it case kmalloc fails and not -ENOMEM (-12).
I will submit a new patch to fix this.
Dzmitry
PATCH v4 1/1 staging: gs_fpgaboot: Fix "out of memory" error handling
Fix "out of memory" error handling
--- drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/gs_fpgaboot/gs_fpgaboot.c +2 -3
@@ -295,8 +295,8 @@ static int gs_fpgaboot(void)struct fpgaimage *fimage; fimage =kmalloc (sizeof (struct fpgaimage ),GFP_KERNEL ); -if (fimage ==NULL ) - goto err_out; +if (!fimage) +return -ENOMEM ; err =gs_load_image (fimage, file);if (err) {
@@ -338,7 +338,6 @@ err_out2: err_out1:kfree (fimage); -err_out:return -1 ; }
Signature · 1 line
2.1.2