fpga: altera-pr-ip: fix unsigned comparison with less than zero
PATCH 1/1 fpga: altera-pr-ip: fix unsigned comparison with less than zero
Fix the "comparison with less than zero" warning reported by cppcheck for the unsigned (size_t) parameter "count" of the "alt_pr_fpga_write()" function.
--- drivers/fpga/altera-pr-ip-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/altera-pr-ip-core.c +1 -1
@@ -108,7 +108,7 @@ static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf,u32 *buffer_32 = (u32 *)buf;size_t i =0 ; -if (count <=0 ) +if (count ==0 )return -EINVAL ;/* Write out the complete 32-bit chunks */
Signature · 1 line
2.35.1
Quoted 14 lines · Marco Pagani
Fix the "comparison with less than zero" warning reported by cppcheck for the unsigned (
size_t) parameter "count" of the "alt_pr_fpga_write()" function.Signed-off-by Marco Pagani <[email protected]>--- drivers/fpga/altera-pr-ip-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/fpga/altera-pr-ip-core.c +0
-0
drivers/fpga/altera-pr-ip-core.c static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf, · line 112
Quoted 6 lines
drivers/fpga/altera-pr-ip-core.c +1
-1@@ -108,7 +108,7 @@ static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf,u32 *buffer_32 = (u32 *)buf;size_t i =0 ; -if (count <=0 ) +if (count ==0 )return -EINVAL ;
Quoted 2 lines
drivers/fpga/altera-pr-ip-core.c +0
-0/* Write out the complete 32-bit chunks */
Quoted 11 lines · Tom Rix
Quoted 9 lines · Marco Pagani
Fix the "comparison with less than zero" warning reported by cppcheck for the unsigned (
size_t) parameter "count" of the "alt_pr_fpga_write()" function.Signed-off-by Marco Pagani <[email protected]>--- drivers/fpga/altera-pr-ip-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
drivers/fpga/altera-pr-ip-core.c static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf, · line 111
Quoted 10 lines
drivers/fpga/altera-pr-ip-core.c +1
-1@@ -108,7 +108,7 @@ static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf,u32 *buffer_32 = (u32 *)buf;size_t i =0 ; -if (count <=0 ) +if (count ==0 )return -EINVAL ;Reviewed-by Tom Rix <[email protected]>
Quoted 2 lines
Quoted 2 lines
drivers/fpga/altera-pr-ip-core.c +0
-0/* Write out the complete 32-bit chunks */
Moritz Fischer
maintainerMarco,
Quoted 4 lines · Marco Pagani
Fix the "comparison with less than zero" warning reported by cppcheck for the unsigned (
size_t) parameter "count" of the "alt_pr_fpga_write()" function.
Should this have a Reported-by: tag?
Quoted 10 lines
Signed-off-by Marco Pagani <[email protected]>--- drivers/fpga/altera-pr-ip-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/fpga/altera-pr-ip-core.c +0
-0
drivers/fpga/altera-pr-ip-core.c static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf, · line 112
Quoted 6 lines
drivers/fpga/altera-pr-ip-core.c +1
-1@@ -108,7 +108,7 @@ static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf,u32 *buffer_32 = (u32 *)buf;size_t i =0 ; -if (count <=0 ) +if (count ==0 )return -EINVAL ;
if (!count)
return -EINVAL?
Quoted 4 lines
drivers/fpga/altera-pr-ip-core.c +0
-0/* Write out the complete 32-bit chunks */ Signature · 1 line
2.35.1
Cheers,
Moritz
Quoted 1 line
Quoted 8 lines · Moritz Fischer
Marco,
Quoted 4 lines · Marco Pagani
Fix the "comparison with less than zero" warning reported by cppcheck for the unsigned (
size_t) parameter "count" of the "alt_pr_fpga_write()" function.Should this have a Reported-by: tag?
I found this problem using the "cppcheck" tool, as reported in the commit log. I did not find any previous report of this. Am I missing something?
Quoted 13 lines
Quoted 13 lines
Signed-off-by Marco Pagani <[email protected]>--- drivers/fpga/altera-pr-ip-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/fpga/altera-pr-ip-core.c +0
-0@@ -108,7 +108,7 @@ static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf,u32 *buffer_32 = (u32 *)buf;size_t i =0 ;
Quoted 6 lines
drivers/fpga/altera-pr-ip-core.c static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf, · line 112
Quoted 3 lines
drivers/fpga/altera-pr-ip-core.c +1
-1-if (count <=0 ) +if (count ==0 )return -EINVAL ;if (!count)
return-EINVAL?
Ok, I'll change that in v2.
Quoted 9 lines
Quoted 4 lines
drivers/fpga/altera-pr-ip-core.c +0
-0/* Write out the complete 32-bit chunks */ Signature · 1 line
2.35.1Cheers,
MoritzQuoted 1 line
Cheers,
Marco