linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: media-atomisp : fix "dubious: !x | !y" sparse warning
@ 2020-08-25 22:04 Anant Thazhemadam
  2020-08-26  9:50 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Anant Thazhemadam @ 2020-08-25 22:04 UTC (permalink / raw)
  To: anant.thazhemadam
  Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
	linux-media, devel, linux-kernel

Upon running sparse, "warning: dubious: !x | !y" is brought to notice
for this file. This patch fixes that warning.

If there's a specific reason that this change is considered undesirable, 
please do let me know why.
Thanks.

Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
---
 .../media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
index 358cb7d2cd4c..3b850bb2d39d 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
@@ -58,7 +58,7 @@ sh_css_vf_downscale_log2(
 	unsigned int ds_log2 = 0;
 	unsigned int out_width;
 
-	if ((!out_info) | (!vf_info))
+	if ((!out_info) || (!vf_info))
 		return -EINVAL;
 
 	out_width = out_info->res.width;
-- 
2.25.1


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

* Re: [PATCH] staging: media-atomisp : fix "dubious: !x | !y" sparse warning
  2020-08-25 22:04 [PATCH] staging: media-atomisp : fix "dubious: !x | !y" sparse warning Anant Thazhemadam
@ 2020-08-26  9:50 ` Dan Carpenter
  2020-08-26 11:09   ` [PATCH v2] staging: media/atomisp " Anant Thazhemadam
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2020-08-26  9:50 UTC (permalink / raw)
  To: Anant Thazhemadam
  Cc: devel, Greg Kroah-Hartman, linux-kernel, Sakari Ailus,
	Mauro Carvalho Chehab, linux-media

On Wed, Aug 26, 2020 at 03:34:26AM +0530, Anant Thazhemadam wrote:
> Upon running sparse, "warning: dubious: !x | !y" is brought to notice
> for this file. This patch fixes that warning.
> 
> If there's a specific reason that this change is considered undesirable, 
> please do let me know why.
> Thanks.

Please don't put this sort of comments in the commit message.  You can
put it under the --- cut off

> 
> Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
> ---
  ^^^
here.  Then it will be removed instead of going into the permanent git
log.

Please always say int the commit message how the patch will affect the
runtime behavior of the kernel.  In this case it will not affect it at
all.  It's just a clean up.  Her is my proposed commit message if you
want:

Subject: [PATCH] staging: media-atomisp : silence "dubious: !x | !y" warning

Upon running sparse, "warning: dubious: !x | !y" is brought to notice
for this file.  Logical and bitwise OR are basically the same in this
context so it doesn't cause a runtime bug.  But let's change it to
logical OR to make it cleaner and silence the Sparse warning.

regards,
dan carpenter





>  .../media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c    | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
> index 358cb7d2cd4c..3b850bb2d39d 100644
> --- a/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
> +++ b/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
> @@ -58,7 +58,7 @@ sh_css_vf_downscale_log2(
>  	unsigned int ds_log2 = 0;
>  	unsigned int out_width;
>  
> -	if ((!out_info) | (!vf_info))
> +	if ((!out_info) || (!vf_info))
>  		return -EINVAL;
>  
>  	out_width = out_info->res.width;
> -- 
> 2.25.1
> 
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v2] staging: media/atomisp : fix "dubious: !x | !y" sparse warning
  2020-08-26  9:50 ` Dan Carpenter
@ 2020-08-26 11:09   ` Anant Thazhemadam
  0 siblings, 0 replies; 3+ messages in thread
From: Anant Thazhemadam @ 2020-08-26 11:09 UTC (permalink / raw)
  Cc: anant.thazhemadam, Mauro Carvalho Chehab, Sakari Ailus,
	Greg Kroah-Hartman, linux-media, devel, linux-kernel

Upon running Sparse, "warning: dubious: !x | !y" is brought to notice
for this file.  Logical and bitwise OR are basically the same in this
context, so it doesn't cause a runtime bug.  But let's change it to
logical OR to make it a little bit cleaner and silence the Sparse
warning.

Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
---
 .../media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
index 358cb7d2cd4c..3b850bb2d39d 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
@@ -58,7 +58,7 @@ sh_css_vf_downscale_log2(
 	unsigned int ds_log2 = 0;
 	unsigned int out_width;
 
-	if ((!out_info) | (!vf_info))
+	if ((!out_info) || (!vf_info))
 		return -EINVAL;
 
 	out_width = out_info->res.width;
-- 
2.25.1

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

end of thread, other threads:[~2020-08-26 11:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25 22:04 [PATCH] staging: media-atomisp : fix "dubious: !x | !y" sparse warning Anant Thazhemadam
2020-08-26  9:50 ` Dan Carpenter
2020-08-26 11:09   ` [PATCH v2] staging: media/atomisp " Anant Thazhemadam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).