Skip to contentSkip to conversation

staging: media-atomisp : fix "dubious: !x | !y" sparse warning

PATCH Superseded Anant Thazhemadam 2 participants 3 messages Aug 25, 2020 – Aug 26, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: media-atomisp : fix "dubious: !x | !y" sparse warning

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.

---
 .../media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c +1 -1
index 358cb7d2cd4c..3b850bb2d39d 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Anant Thazhemadam

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

Quoted 3 lines

---

^^^
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

Quoted 23 lines
 .../media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c +1 -1
index 358cb7d2cd4c..3b850bb2d39d 100644
@@ -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;
Signature · 6 lines
2.25.1

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
#2 lore raw

PATCH v2 1/1 staging: media/atomisp : fix "dubious: !x | !y" sparse 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 a little bit cleaner and silence the Sparse warning.

---
 .../media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c +1 -1
index 358cb7d2cd4c..3b850bb2d39d 100644
@@ -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;
Signature · 1 line
2.25.1