All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 001/002] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning
@ 2014-10-07 14:37 Dzmitry Sledneu
  2014-10-07 14:39 ` [PATCH 002/002] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" " Dzmitry Sledneu
  0 siblings, 1 reply; 10+ messages in thread
From: Dzmitry Sledneu @ 2014-10-07 14:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, devel

Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning

Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>

---
 drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index 6aa9d7c..6129164 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -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]);
 	}
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 002/002] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
  2014-10-07 14:37 [PATCH 001/002] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning Dzmitry Sledneu
@ 2014-10-07 14:39 ` Dzmitry Sledneu
  2014-10-07 15:23   ` [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" " Dzmitry Sledneu
  0 siblings, 1 reply; 10+ messages in thread
From: Dzmitry Sledneu @ 2014-10-07 14:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, devel

Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning

Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>

---
 drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index 6129164..b7ca3a3 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -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) {
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning
  2014-10-07 14:39 ` [PATCH 002/002] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" " Dzmitry Sledneu
@ 2014-10-07 15:23   ` Dzmitry Sledneu
  2014-10-07 15:24     ` [PATCH v2 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" " Dzmitry Sledneu
  2014-10-07 15:30     ` [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" " Joe Perches
  0 siblings, 2 replies; 10+ messages in thread
From: Dzmitry Sledneu @ 2014-10-07 15:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, devel

Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning

Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>

---
 drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index 6aa9d7c..6129164 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -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]);
 	}
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
  2014-10-07 15:23   ` [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" " Dzmitry Sledneu
@ 2014-10-07 15:24     ` Dzmitry Sledneu
  2014-10-07 15:30     ` [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" " Joe Perches
  1 sibling, 0 replies; 10+ messages in thread
From: Dzmitry Sledneu @ 2014-10-07 15:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, devel

Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning

Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>

---
 drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index 6129164..cc788f1 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -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;
 
 }
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning
  2014-10-07 15:23   ` [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" " Dzmitry Sledneu
  2014-10-07 15:24     ` [PATCH v2 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" " Dzmitry Sledneu
@ 2014-10-07 15:30     ` Joe Perches
  2014-10-07 15:53       ` [PATCH v3 1/2] staging: gs_fpgaboot: Use print_hex_dump_bytes instead of pr_info Dzmitry Sledneu
  1 sibling, 1 reply; 10+ messages in thread
From: Joe Perches @ 2014-10-07 15:30 UTC (permalink / raw)
  To: Dzmitry Sledneu; +Cc: Greg Kroah-Hartman, linux-kernel, devel

On Tue, 2014-10-07 at 17:23 +0200, Dzmitry Sledneu wrote:
> Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning
[]
> diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
[]
> @@ -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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3 1/2] staging: gs_fpgaboot: Use print_hex_dump_bytes instead of pr_info
  2014-10-07 15:30     ` [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" " Joe Perches
@ 2014-10-07 15:53       ` Dzmitry Sledneu
  2014-10-07 15:54         ` [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning Dzmitry Sledneu
  0 siblings, 1 reply; 10+ messages in thread
From: Dzmitry Sledneu @ 2014-10-07 15:53 UTC (permalink / raw)
  To: Joe Perches, Greg Kroah-Hartman; +Cc: linux-kernel, devel

From: Joe Perches <joe@perches.com>

Use print_hex_dump_bytes instead of pr_info

Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>
Reviewed-by: Insop Song <insop.song@gainspeed.com>

---
 drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index 6aa9d7c..9764a9a 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -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);
-- 
2.1.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
  2014-10-07 15:53       ` [PATCH v3 1/2] staging: gs_fpgaboot: Use print_hex_dump_bytes instead of pr_info Dzmitry Sledneu
@ 2014-10-07 15:54         ` Dzmitry Sledneu
  2014-10-08 22:48           ` Greg Kroah-Hartman
  0 siblings, 1 reply; 10+ messages in thread
From: Dzmitry Sledneu @ 2014-10-07 15:54 UTC (permalink / raw)
  To: Joe Perches, Greg Kroah-Hartman; +Cc: linux-kernel, devel

Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning

Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>

---
 drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index 9764a9a..0c18c4c 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -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;
 
 }
-- 
2.1.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
  2014-10-07 15:54         ` [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning Dzmitry Sledneu
@ 2014-10-08 22:48           ` Greg Kroah-Hartman
  2014-10-09  7:20             ` Dzmitry Sledneu
  0 siblings, 1 reply; 10+ messages in thread
From: Greg Kroah-Hartman @ 2014-10-08 22:48 UTC (permalink / raw)
  To: Dzmitry Sledneu; +Cc: Joe Perches, devel, linux-kernel

On Tue, Oct 07, 2014 at 05:54:48PM +0200, Dzmitry Sledneu wrote:
> Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
> 
> Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>
> 
> ---
>  drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
> index 9764a9a..0c18c4c 100644
> --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
> +++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
> @@ -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;
>  
>  }

Doesn't apply to my tree properly :(

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
  2014-10-08 22:48           ` Greg Kroah-Hartman
@ 2014-10-09  7:20             ` Dzmitry Sledneu
  2014-10-09  7:22               ` [PATCH v4] staging: gs_fpgaboot: Fix "out of memory" error handling Dzmitry Sledneu
  0 siblings, 1 reply; 10+ messages in thread
From: Dzmitry Sledneu @ 2014-10-09  7:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Joe Perches, devel, linux-kernel

On 10/09/2014 12:48 AM, Greg Kroah-Hartman wrote:
> On Tue, Oct 07, 2014 at 05:54:48PM +0200, Dzmitry Sledneu wrote:
>> Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
>>
>> Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>
>>
>> ---
>>  drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
>> index 9764a9a..0c18c4c 100644
>> --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
>> +++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
>> @@ -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;
>>  
>>  }
> 
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4] staging: gs_fpgaboot: Fix "out of memory" error handling
  2014-10-09  7:20             ` Dzmitry Sledneu
@ 2014-10-09  7:22               ` Dzmitry Sledneu
  0 siblings, 0 replies; 10+ messages in thread
From: Dzmitry Sledneu @ 2014-10-09  7:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Joe Perches, devel, linux-kernel

Fix "out of memory" error handling

Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>

---
 drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index cbf70ce..0c18c4c 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -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;
 
 }
-- 
2.1.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-10-09  7:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-07 14:37 [PATCH 001/002] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning Dzmitry Sledneu
2014-10-07 14:39 ` [PATCH 002/002] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" " Dzmitry Sledneu
2014-10-07 15:23   ` [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" " Dzmitry Sledneu
2014-10-07 15:24     ` [PATCH v2 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" " Dzmitry Sledneu
2014-10-07 15:30     ` [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" " Joe Perches
2014-10-07 15:53       ` [PATCH v3 1/2] staging: gs_fpgaboot: Use print_hex_dump_bytes instead of pr_info Dzmitry Sledneu
2014-10-07 15:54         ` [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning Dzmitry Sledneu
2014-10-08 22:48           ` Greg Kroah-Hartman
2014-10-09  7:20             ` Dzmitry Sledneu
2014-10-09  7:22               ` [PATCH v4] staging: gs_fpgaboot: Fix "out of memory" error handling Dzmitry Sledneu

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.