* [PATCH 00/14] Modify signed comparisons of unsigned variables
@ 2012-11-16 6:50 Tushar Behera
2012-11-16 6:50 ` [PATCH 01/14] [media] ivtv: Remove redundant check on unsigned variable Tushar Behera
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Tushar Behera @ 2012-11-16 6:50 UTC (permalink / raw)
To: linux-kernel
Cc: patches, Mauro Carvalho Chehab, Linus Walleij, Ian Campbell,
Konrad Rzeszutek Wilk, Jeremy Fitzhardinge, Chas Williams,
Jack Steiner, Arnd Bergmann, Luciano Coelho, Jiri Kosina,
ivtv-devel, linux-media, xen-devel, netdev, virtualization,
linux-atm-general, linux-usb, linux-input, linux-wireless
The occurrences were identified through the coccinelle script at
following location.
http://www.emn.fr/z-info/coccinelle/rules/find_unsigned.cocci
Signed checks for unsigned variables are removed if it is also checked
for upper error limit. For error checks, IS_ERR_VALUE() macros is used.
Tushar Behera (14):
[media] ivtv: Remove redundant check on unsigned variable
[media] meye: Remove redundant check on unsigned variable
[media] saa7134: Remove redundant check on unsigned variable
[media] tlg2300: Remove redundant check on unsigned variable
[media] atmel-isi: Update error check for unsigned variables
pinctrl: samsung: Update error check for unsigned variables
pinctrl: SPEAr: Update error check for unsigned variables
xen: netback: Remove redundant check on unsigned variable
xen: events: Remove redundant check on unsigned variable
atm: Removed redundant check on unsigned variable
HID: hiddev: Remove redundant check on unsigned variable
gru: Remove redundant check on unsigned variable
misc: tsl2550: Remove redundant check on unsigned variable
wlcore: Remove redundant check on unsigned variable
drivers/atm/fore200e.c | 2 +-
drivers/hid/usbhid/hiddev.c | 2 +-
drivers/media/pci/ivtv/ivtv-ioctl.c | 2 +-
drivers/media/pci/meye/meye.c | 2 +-
drivers/media/pci/saa7134/saa7134-video.c | 2 +-
drivers/media/platform/soc_camera/atmel-isi.c | 2 +-
drivers/media/usb/tlg2300/pd-video.c | 2 +-
drivers/misc/sgi-gru/grukdump.c | 2 +-
drivers/misc/tsl2550.c | 4 ++--
drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
drivers/net/xen-netback/netback.c | 4 ++--
drivers/pinctrl/pinctrl-samsung.c | 2 +-
drivers/pinctrl/spear/pinctrl-plgpio.c | 2 +-
drivers/xen/events.c | 2 +-
14 files changed, 16 insertions(+), 16 deletions(-)
--
1.7.4.1
CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: Linus Walleij <linus.walleij@linaro.org>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Jeremy Fitzhardinge <jeremy@goop.org>
CC: Chas Williams <chas@cmf.nrl.navy.mil>
CC: Jack Steiner <steiner@sgi.com>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Luciano Coelho <coelho@ti.com>
CC: Jiri Kosina <jkosina@suse.cz>
CC: ivtv-devel@ivtvdriver.org
CC: linux-media@vger.kernel.org
CC: xen-devel@lists.xensource.com
CC: netdev@vger.kernel.org
CC: virtualization@lists.linux-foundation.org
CC: linux-atm-general@lists.sourceforge.net
CC: linux-usb@vger.kernel.org
CC: linux-input@vger.kernel.org
CC: linux-wireless@vger.kernel.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 01/14] [media] ivtv: Remove redundant check on unsigned variable
2012-11-16 6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
@ 2012-11-16 6:50 ` Tushar Behera
2012-11-16 6:50 ` [PATCH 02/14] [media] meye: " Tushar Behera
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Tushar Behera @ 2012-11-16 6:50 UTC (permalink / raw)
To: linux-kernel; +Cc: patches, Mauro Carvalho Chehab, ivtv-devel, linux-media
No need to check whether unsigned variable is less than 0.
CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: ivtv-devel@ivtvdriver.org
CC: linux-media@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
drivers/media/pci/ivtv/ivtv-ioctl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c
index 949ae23..4b47b5c 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -993,7 +993,7 @@ int ivtv_s_input(struct file *file, void *fh, unsigned int inp)
v4l2_std_id std;
int i;
- if (inp < 0 || inp >= itv->nof_inputs)
+ if (inp >= itv->nof_inputs)
return -EINVAL;
if (inp == itv->active_input) {
--
1.7.4.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 02/14] [media] meye: Remove redundant check on unsigned variable
2012-11-16 6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
2012-11-16 6:50 ` [PATCH 01/14] [media] ivtv: Remove redundant check on unsigned variable Tushar Behera
@ 2012-11-16 6:50 ` Tushar Behera
2012-11-16 6:50 ` [PATCH 03/14] [media] saa7134: " Tushar Behera
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Tushar Behera @ 2012-11-16 6:50 UTC (permalink / raw)
To: linux-kernel; +Cc: patches, Mauro Carvalho Chehab, linux-media
No need to check whether unsigned variable is less than 0.
CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: linux-media@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
drivers/media/pci/meye/meye.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
index e5a76da..ae7d320 100644
--- a/drivers/media/pci/meye/meye.c
+++ b/drivers/media/pci/meye/meye.c
@@ -1945,7 +1945,7 @@ static struct pci_driver meye_driver = {
static int __init meye_init(void)
{
gbuffers = max(2, min((int)gbuffers, MEYE_MAX_BUFNBRS));
- if (gbufsize < 0 || gbufsize > MEYE_MAX_BUFSIZE)
+ if (gbufsize > MEYE_MAX_BUFSIZE)
gbufsize = MEYE_MAX_BUFSIZE;
gbufsize = PAGE_ALIGN(gbufsize);
printk(KERN_INFO "meye: using %d buffers with %dk (%dk total) "
--
1.7.4.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 03/14] [media] saa7134: Remove redundant check on unsigned variable
2012-11-16 6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
2012-11-16 6:50 ` [PATCH 01/14] [media] ivtv: Remove redundant check on unsigned variable Tushar Behera
2012-11-16 6:50 ` [PATCH 02/14] [media] meye: " Tushar Behera
@ 2012-11-16 6:50 ` Tushar Behera
2012-11-16 6:50 ` [PATCH 04/14] [media] tlg2300: " Tushar Behera
2012-11-16 6:50 ` [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables Tushar Behera
4 siblings, 0 replies; 8+ messages in thread
From: Tushar Behera @ 2012-11-16 6:50 UTC (permalink / raw)
To: linux-kernel; +Cc: patches, Mauro Carvalho Chehab, linux-media
No need to check whether the unsigned variable is less than 0.
CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: linux-media@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
drivers/media/pci/saa7134/saa7134-video.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c
index 4a77124..3abf527 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -2511,7 +2511,7 @@ int saa7134_video_init1(struct saa7134_dev *dev)
/* sanitycheck insmod options */
if (gbuffers < 2 || gbuffers > VIDEO_MAX_FRAME)
gbuffers = 2;
- if (gbufsize < 0 || gbufsize > gbufsize_max)
+ if (gbufsize > gbufsize_max)
gbufsize = gbufsize_max;
gbufsize = (gbufsize + PAGE_SIZE - 1) & PAGE_MASK;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 04/14] [media] tlg2300: Remove redundant check on unsigned variable
2012-11-16 6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
` (2 preceding siblings ...)
2012-11-16 6:50 ` [PATCH 03/14] [media] saa7134: " Tushar Behera
@ 2012-11-16 6:50 ` Tushar Behera
2012-11-16 6:50 ` [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables Tushar Behera
4 siblings, 0 replies; 8+ messages in thread
From: Tushar Behera @ 2012-11-16 6:50 UTC (permalink / raw)
To: linux-kernel; +Cc: patches, Mauro Carvalho Chehab, linux-media
No need to check whether unsigned variable is less than 0.
CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: linux-media@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
drivers/media/usb/tlg2300/pd-video.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/usb/tlg2300/pd-video.c b/drivers/media/usb/tlg2300/pd-video.c
index 1f448ac..dd157e7 100644
--- a/drivers/media/usb/tlg2300/pd-video.c
+++ b/drivers/media/usb/tlg2300/pd-video.c
@@ -923,7 +923,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int i)
struct poseidon *pd = front->pd;
s32 ret, cmd_status;
- if (i < 0 || i >= POSEIDON_INPUTS)
+ if (i >= POSEIDON_INPUTS)
return -EINVAL;
ret = send_set_req(pd, SGNL_SRC_SEL,
pd_inputs[i].tlg_src, &cmd_status);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables
2012-11-16 6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
` (3 preceding siblings ...)
2012-11-16 6:50 ` [PATCH 04/14] [media] tlg2300: " Tushar Behera
@ 2012-11-16 6:50 ` Tushar Behera
2012-11-17 23:16 ` Guennadi Liakhovetski
4 siblings, 1 reply; 8+ messages in thread
From: Tushar Behera @ 2012-11-16 6:50 UTC (permalink / raw)
To: linux-kernel; +Cc: patches, Mauro Carvalho Chehab, linux-media
Checking '< 0' for unsigned variables always returns false. For error
codes, use IS_ERR_VALUE() instead.
CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: linux-media@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
drivers/media/platform/soc_camera/atmel-isi.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
index 6274a91..5bd65df 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -1020,7 +1020,7 @@ static int __devinit atmel_isi_probe(struct platform_device *pdev)
isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
+ if (IS_ERR_VALUE(irq)) {
ret = irq;
goto err_req_irq;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables
2012-11-16 6:50 ` [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables Tushar Behera
@ 2012-11-17 23:16 ` Guennadi Liakhovetski
2012-11-19 3:55 ` Tushar Behera
0 siblings, 1 reply; 8+ messages in thread
From: Guennadi Liakhovetski @ 2012-11-17 23:16 UTC (permalink / raw)
To: Tushar Behera; +Cc: linux-kernel, patches, Mauro Carvalho Chehab, linux-media
On Fri, 16 Nov 2012, Tushar Behera wrote:
> Checking '< 0' for unsigned variables always returns false. For error
> codes, use IS_ERR_VALUE() instead.
Wouldn't just changing "irq" type to "int" also work? I think that would
be a more straight-forward solution. If however there are strong arguments
against that, I'm fine with this fix too.
Thanks
Guennadi
>
> CC: Mauro Carvalho Chehab <mchehab@infradead.org>
> CC: linux-media@vger.kernel.org
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
> drivers/media/platform/soc_camera/atmel-isi.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
> index 6274a91..5bd65df 100644
> --- a/drivers/media/platform/soc_camera/atmel-isi.c
> +++ b/drivers/media/platform/soc_camera/atmel-isi.c
> @@ -1020,7 +1020,7 @@ static int __devinit atmel_isi_probe(struct platform_device *pdev)
> isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> + if (IS_ERR_VALUE(irq)) {
> ret = irq;
> goto err_req_irq;
> }
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables
2012-11-17 23:16 ` Guennadi Liakhovetski
@ 2012-11-19 3:55 ` Tushar Behera
0 siblings, 0 replies; 8+ messages in thread
From: Tushar Behera @ 2012-11-19 3:55 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-kernel, patches, Mauro Carvalho Chehab, linux-media
On 11/18/2012 04:46 AM, Guennadi Liakhovetski wrote:
> On Fri, 16 Nov 2012, Tushar Behera wrote:
>
>> Checking '< 0' for unsigned variables always returns false. For error
>> codes, use IS_ERR_VALUE() instead.
>
> Wouldn't just changing "irq" type to "int" also work? I think that would
> be a more straight-forward solution. If however there are strong arguments
> against that, I'm fine with this fix too.
>
By changing irq to signed variable, we would get compilation warning in
subsequent line (request_irq).
> Thanks
> Guennadi
>
>>
>> CC: Mauro Carvalho Chehab <mchehab@infradead.org>
>> CC: linux-media@vger.kernel.org
>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>> ---
>> drivers/media/platform/soc_camera/atmel-isi.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
>> index 6274a91..5bd65df 100644
>> --- a/drivers/media/platform/soc_camera/atmel-isi.c
>> +++ b/drivers/media/platform/soc_camera/atmel-isi.c
>> @@ -1020,7 +1020,7 @@ static int __devinit atmel_isi_probe(struct platform_device *pdev)
>> isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
>>
>> irq = platform_get_irq(pdev, 0);
>> - if (irq < 0) {
>> + if (IS_ERR_VALUE(irq)) {
>> ret = irq;
>> goto err_req_irq;
>> }
>> --
>> 1.7.4.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
>
--
Tushar Behera
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-11-19 3:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-16 6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
2012-11-16 6:50 ` [PATCH 01/14] [media] ivtv: Remove redundant check on unsigned variable Tushar Behera
2012-11-16 6:50 ` [PATCH 02/14] [media] meye: " Tushar Behera
2012-11-16 6:50 ` [PATCH 03/14] [media] saa7134: " Tushar Behera
2012-11-16 6:50 ` [PATCH 04/14] [media] tlg2300: " Tushar Behera
2012-11-16 6:50 ` [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables Tushar Behera
2012-11-17 23:16 ` Guennadi Liakhovetski
2012-11-19 3:55 ` Tushar Behera
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).