netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: sja1000_isa: fix "limited range" compiler warnings
@ 2011-11-24  9:08 Wolfgang Grandegger
  2011-11-24  9:34 ` Marc Kleine-Budde
  2011-11-29 23:29 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Wolfgang Grandegger @ 2011-11-24  9:08 UTC (permalink / raw)
  To: Netdev; +Cc: linux-can@vger.kernel.org

This patch fixes the compiler warnings: "comparison is always
false due to limited range of data type" by using "0xff" instead
of "-1" for unsigned values.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
 drivers/net/can/sja1000/sja1000_isa.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/can/sja1000/sja1000_isa.c b/drivers/net/can/sja1000/sja1000_isa.c
index 496223e..f0840d5 100644
--- a/drivers/net/can/sja1000/sja1000_isa.c
+++ b/drivers/net/can/sja1000/sja1000_isa.c
@@ -44,9 +44,9 @@ static unsigned long port[MAXDEV];
 static unsigned long mem[MAXDEV];
 static int __devinitdata irq[MAXDEV];
 static int __devinitdata clk[MAXDEV];
-static char __devinitdata cdr[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1};
-static char __devinitdata ocr[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1};
-static char __devinitdata indirect[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1};
+static unsigned char __devinitdata cdr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff};
+static unsigned char __devinitdata ocr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff};
+static int __devinitdata indirect[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1};
 
 module_param_array(port, ulong, NULL, S_IRUGO);
 MODULE_PARM_DESC(port, "I/O port number");
@@ -54,7 +54,7 @@ MODULE_PARM_DESC(port, "I/O port number");
 module_param_array(mem, ulong, NULL, S_IRUGO);
 MODULE_PARM_DESC(mem, "I/O memory address");
 
-module_param_array(indirect, byte, NULL, S_IRUGO);
+module_param_array(indirect, int, NULL, S_IRUGO);
 MODULE_PARM_DESC(indirect, "Indirect access via address and data port");
 
 module_param_array(irq, int, NULL, S_IRUGO);
@@ -189,17 +189,17 @@ static int __devinit sja1000_isa_probe(struct device *pdev, unsigned int idx)
 	else
 		priv->can.clock.freq = CLK_DEFAULT / 2;
 
-	if (ocr[idx] != -1)
-		priv->ocr = ocr[idx] & 0xff;
-	else if (ocr[0] != -1)
-		priv->ocr = ocr[0] & 0xff;
+	if (ocr[idx] != 0xff)
+		priv->ocr = ocr[idx];
+	else if (ocr[0] != 0xff)
+		priv->ocr = ocr[0];
 	else
 		priv->ocr = OCR_DEFAULT;
 
-	if (cdr[idx] != -1)
-		priv->cdr = cdr[idx] & 0xff;
-	else if (cdr[0] != -1)
-		priv->cdr = cdr[0] & 0xff;
+	if (cdr[idx] != 0xff)
+		priv->cdr = cdr[idx];
+	else if (cdr[0] != 0xff)
+		priv->cdr = cdr[0];
 	else
 		priv->cdr = CDR_DEFAULT;
 
-- 
1.7.4.1

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

* Re: [PATCH] can: sja1000_isa: fix "limited range" compiler warnings
  2011-11-24  9:08 [PATCH] can: sja1000_isa: fix "limited range" compiler warnings Wolfgang Grandegger
@ 2011-11-24  9:34 ` Marc Kleine-Budde
  2011-11-29 23:29 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2011-11-24  9:34 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: Netdev, linux-can@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 2851 bytes --]

On 11/24/2011 10:08 AM, Wolfgang Grandegger wrote:
> This patch fixes the compiler warnings: "comparison is always
> false due to limited range of data type" by using "0xff" instead
> of "-1" for unsigned values.
> 
> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
>  drivers/net/can/sja1000/sja1000_isa.c |   24 ++++++++++++------------
>  1 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/can/sja1000/sja1000_isa.c b/drivers/net/can/sja1000/sja1000_isa.c
> index 496223e..f0840d5 100644
> --- a/drivers/net/can/sja1000/sja1000_isa.c
> +++ b/drivers/net/can/sja1000/sja1000_isa.c
> @@ -44,9 +44,9 @@ static unsigned long port[MAXDEV];
>  static unsigned long mem[MAXDEV];
>  static int __devinitdata irq[MAXDEV];
>  static int __devinitdata clk[MAXDEV];
> -static char __devinitdata cdr[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1};
> -static char __devinitdata ocr[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1};
> -static char __devinitdata indirect[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1};
> +static unsigned char __devinitdata cdr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff};
> +static unsigned char __devinitdata ocr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff};
> +static int __devinitdata indirect[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1};
>  
>  module_param_array(port, ulong, NULL, S_IRUGO);
>  MODULE_PARM_DESC(port, "I/O port number");
> @@ -54,7 +54,7 @@ MODULE_PARM_DESC(port, "I/O port number");
>  module_param_array(mem, ulong, NULL, S_IRUGO);
>  MODULE_PARM_DESC(mem, "I/O memory address");
>  
> -module_param_array(indirect, byte, NULL, S_IRUGO);
> +module_param_array(indirect, int, NULL, S_IRUGO);
>  MODULE_PARM_DESC(indirect, "Indirect access via address and data port");
>  
>  module_param_array(irq, int, NULL, S_IRUGO);
> @@ -189,17 +189,17 @@ static int __devinit sja1000_isa_probe(struct device *pdev, unsigned int idx)
>  	else
>  		priv->can.clock.freq = CLK_DEFAULT / 2;
>  
> -	if (ocr[idx] != -1)
> -		priv->ocr = ocr[idx] & 0xff;
> -	else if (ocr[0] != -1)
> -		priv->ocr = ocr[0] & 0xff;
> +	if (ocr[idx] != 0xff)
> +		priv->ocr = ocr[idx];
> +	else if (ocr[0] != 0xff)
> +		priv->ocr = ocr[0];
>  	else
>  		priv->ocr = OCR_DEFAULT;
>  
> -	if (cdr[idx] != -1)
> -		priv->cdr = cdr[idx] & 0xff;
> -	else if (cdr[0] != -1)
> -		priv->cdr = cdr[0] & 0xff;
> +	if (cdr[idx] != 0xff)
> +		priv->cdr = cdr[idx];
> +	else if (cdr[0] != 0xff)
> +		priv->cdr = cdr[0];
>  	else
>  		priv->cdr = CDR_DEFAULT;
>  


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

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

* Re: [PATCH] can: sja1000_isa: fix "limited range" compiler warnings
  2011-11-24  9:08 [PATCH] can: sja1000_isa: fix "limited range" compiler warnings Wolfgang Grandegger
  2011-11-24  9:34 ` Marc Kleine-Budde
@ 2011-11-29 23:29 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2011-11-29 23:29 UTC (permalink / raw)
  To: wg; +Cc: Netdev, linux-can

From: Wolfgang Grandegger <wg@grandegger.com>
Date: Thu, 24 Nov 2011 10:08:35 +0100

> This patch fixes the compiler warnings: "comparison is always
> false due to limited range of data type" by using "0xff" instead
> of "-1" for unsigned values.
> 
> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>

Applied to net-next, thanks.

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

end of thread, other threads:[~2011-11-29 23:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24  9:08 [PATCH] can: sja1000_isa: fix "limited range" compiler warnings Wolfgang Grandegger
2011-11-24  9:34 ` Marc Kleine-Budde
2011-11-29 23:29 ` David Miller

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).