All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: orion5x/kirkwood/mv78xx0: fix MPP configuration corner cases
@ 2010-10-24  8:12 Mike Rapoport
  2010-10-28 13:13 ` Mike Rapoport
  2010-10-29  4:12 ` Nicolas Pitre
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Rapoport @ 2010-10-24  8:12 UTC (permalink / raw)
  To: linux-arm-kernel

Wrong MPP configuration would cause <cpu>_mpp_conf loop	infinitely
because the mpp list iterator would not be incremented.

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
---
 arch/arm/mach-kirkwood/mpp.c |    5 +++--
 arch/arm/mach-mv78xx0/mpp.c  |    5 +++--
 arch/arm/mach-orion5x/mpp.c  |    5 +++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
index 065187d..273f561 100644
--- a/arch/arm/mach-kirkwood/mpp.c
+++ b/arch/arm/mach-kirkwood/mpp.c
@@ -67,13 +67,13 @@ void __init kirkwood_mpp_conf(unsigned int *mpp_list)
 		if (num > MPP_MAX) {
 			printk(KERN_ERR "kirkwood_mpp_conf: invalid MPP "
 					"number (%u)\n", num);
-			continue;
+			goto next_pin;
 		}
 		if (!(*mpp_list & variant_mask)) {
 			printk(KERN_WARNING
 			       "kirkwood_mpp_conf: requested MPP%u config "
 			       "unavailable on this hardware\n", num);
-			continue;
+			goto next_pin;
 		}
 
 		shift = (num & 7) << 2;
@@ -89,6 +89,7 @@ void __init kirkwood_mpp_conf(unsigned int *mpp_list)
 			gpio_mode = 0;
 		orion_gpio_set_valid(num, gpio_mode);
 
+next_pin:
 		mpp_list++;
 	}
 
diff --git a/arch/arm/mach-mv78xx0/mpp.c b/arch/arm/mach-mv78xx0/mpp.c
index 354ac51..7c1fe2a 100644
--- a/arch/arm/mach-mv78xx0/mpp.c
+++ b/arch/arm/mach-mv78xx0/mpp.c
@@ -62,13 +62,13 @@ void __init mv78xx0_mpp_conf(unsigned int *mpp_list)
 		if (num > MPP_MAX) {
 			printk(KERN_ERR "mv78xx0_mpp_conf: invalid MPP "
 					"number (%u)\n", num);
-			continue;
+			goto next_pin;
 		}
 		if (!(*mpp_list & variant_mask)) {
 			printk(KERN_WARNING
 					"mv78xx0_mpp_conf: requested MPP%u config "
 					"unavailable on this hardware\n", num);
-			continue;
+			goto next_pin;
 		}
 
 		shift = (num & 7) << 2;
@@ -84,6 +84,7 @@ void __init mv78xx0_mpp_conf(unsigned int *mpp_list)
 			gpio_mode = 0;
 		orion_gpio_set_valid(num, gpio_mode);
 
+next_pin:
 		mpp_list++;
 	}
 
diff --git a/arch/arm/mach-orion5x/mpp.c b/arch/arm/mach-orion5x/mpp.c
index bc4c3b9..dc27d1a 100644
--- a/arch/arm/mach-orion5x/mpp.c
+++ b/arch/arm/mach-orion5x/mpp.c
@@ -141,7 +141,7 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
 		else {
 			printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
 					"(%d)\n", mode->mpp);
-			continue;
+			goto next_pin;
 		}
 
 		num_type = determine_type_encoding(mode->mpp, mode->type);
@@ -149,7 +149,7 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
 			printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
 					"combination (%d, %d)\n", mode->mpp,
 					mode->type);
-			continue;
+			goto next_pin;
 		}
 
 		shift = (mode->mpp & 7) << 2;
@@ -161,6 +161,7 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
 
 		orion_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO));
 
+next_pin:
 		mode++;
 	}
 
-- 
1.7.3.1

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

* [PATCH] ARM: orion5x/kirkwood/mv78xx0: fix MPP configuration corner cases
  2010-10-24  8:12 [PATCH] ARM: orion5x/kirkwood/mv78xx0: fix MPP configuration corner cases Mike Rapoport
@ 2010-10-28 13:13 ` Mike Rapoport
  2010-10-29  4:12 ` Nicolas Pitre
  1 sibling, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2010-10-28 13:13 UTC (permalink / raw)
  To: linux-arm-kernel

ping?

On 10/24/10 10:12, Mike Rapoport wrote:
> Wrong MPP configuration would cause <cpu>_mpp_conf loop	infinitely
> because the mpp list iterator would not be incremented.
> 
> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
> ---
>  arch/arm/mach-kirkwood/mpp.c |    5 +++--
>  arch/arm/mach-mv78xx0/mpp.c  |    5 +++--
>  arch/arm/mach-orion5x/mpp.c  |    5 +++--
>  3 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
> index 065187d..273f561 100644
> --- a/arch/arm/mach-kirkwood/mpp.c
> +++ b/arch/arm/mach-kirkwood/mpp.c
> @@ -67,13 +67,13 @@ void __init kirkwood_mpp_conf(unsigned int *mpp_list)
>  		if (num > MPP_MAX) {
>  			printk(KERN_ERR "kirkwood_mpp_conf: invalid MPP "
>  					"number (%u)\n", num);
> -			continue;
> +			goto next_pin;
>  		}
>  		if (!(*mpp_list & variant_mask)) {
>  			printk(KERN_WARNING
>  			       "kirkwood_mpp_conf: requested MPP%u config "
>  			       "unavailable on this hardware\n", num);
> -			continue;
> +			goto next_pin;
>  		}
>  
>  		shift = (num & 7) << 2;
> @@ -89,6 +89,7 @@ void __init kirkwood_mpp_conf(unsigned int *mpp_list)
>  			gpio_mode = 0;
>  		orion_gpio_set_valid(num, gpio_mode);
>  
> +next_pin:
>  		mpp_list++;
>  	}
>  
> diff --git a/arch/arm/mach-mv78xx0/mpp.c b/arch/arm/mach-mv78xx0/mpp.c
> index 354ac51..7c1fe2a 100644
> --- a/arch/arm/mach-mv78xx0/mpp.c
> +++ b/arch/arm/mach-mv78xx0/mpp.c
> @@ -62,13 +62,13 @@ void __init mv78xx0_mpp_conf(unsigned int *mpp_list)
>  		if (num > MPP_MAX) {
>  			printk(KERN_ERR "mv78xx0_mpp_conf: invalid MPP "
>  					"number (%u)\n", num);
> -			continue;
> +			goto next_pin;
>  		}
>  		if (!(*mpp_list & variant_mask)) {
>  			printk(KERN_WARNING
>  					"mv78xx0_mpp_conf: requested MPP%u config "
>  					"unavailable on this hardware\n", num);
> -			continue;
> +			goto next_pin;
>  		}
>  
>  		shift = (num & 7) << 2;
> @@ -84,6 +84,7 @@ void __init mv78xx0_mpp_conf(unsigned int *mpp_list)
>  			gpio_mode = 0;
>  		orion_gpio_set_valid(num, gpio_mode);
>  
> +next_pin:
>  		mpp_list++;
>  	}
>  
> diff --git a/arch/arm/mach-orion5x/mpp.c b/arch/arm/mach-orion5x/mpp.c
> index bc4c3b9..dc27d1a 100644
> --- a/arch/arm/mach-orion5x/mpp.c
> +++ b/arch/arm/mach-orion5x/mpp.c
> @@ -141,7 +141,7 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
>  		else {
>  			printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
>  					"(%d)\n", mode->mpp);
> -			continue;
> +			goto next_pin;
>  		}
>  
>  		num_type = determine_type_encoding(mode->mpp, mode->type);
> @@ -149,7 +149,7 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
>  			printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
>  					"combination (%d, %d)\n", mode->mpp,
>  					mode->type);
> -			continue;
> +			goto next_pin;
>  		}
>  
>  		shift = (mode->mpp & 7) << 2;
> @@ -161,6 +161,7 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
>  
>  		orion_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO));
>  
> +next_pin:
>  		mode++;
>  	}
>  


-- 
Sincerely yours,
Mike.

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

* [PATCH] ARM: orion5x/kirkwood/mv78xx0: fix MPP configuration corner cases
  2010-10-24  8:12 [PATCH] ARM: orion5x/kirkwood/mv78xx0: fix MPP configuration corner cases Mike Rapoport
  2010-10-28 13:13 ` Mike Rapoport
@ 2010-10-29  4:12 ` Nicolas Pitre
  2010-10-30 22:18   ` Ben Dooks
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Pitre @ 2010-10-29  4:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, 24 Oct 2010, Mike Rapoport wrote:

> Wrong MPP configuration would cause <cpu>_mpp_conf loop	infinitely
> because the mpp list iterator would not be incremented.
> 
> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
> ---
>  arch/arm/mach-kirkwood/mpp.c |    5 +++--
>  arch/arm/mach-mv78xx0/mpp.c  |    5 +++--
>  arch/arm/mach-orion5x/mpp.c  |    5 +++--
>  3 files changed, 9 insertions(+), 6 deletions(-)
[...]

Instead of adding gotos, could you simply replace the 
"while (*mpp_list)" loop with "for ( ; *mpp_list; mpp_list++)" ?


Nicolas

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

* [PATCH] ARM: orion5x/kirkwood/mv78xx0: fix MPP configuration corner cases
  2010-10-29  4:12 ` Nicolas Pitre
@ 2010-10-30 22:18   ` Ben Dooks
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Dooks @ 2010-10-30 22:18 UTC (permalink / raw)
  To: linux-arm-kernel

On 29/10/10 05:12, Nicolas Pitre wrote:
> On Sun, 24 Oct 2010, Mike Rapoport wrote:
> 
>> Wrong MPP configuration would cause <cpu>_mpp_conf loop	infinitely
>> because the mpp list iterator would not be incremented.
>>
>> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
>> ---
>>  arch/arm/mach-kirkwood/mpp.c |    5 +++--
>>  arch/arm/mach-mv78xx0/mpp.c  |    5 +++--
>>  arch/arm/mach-orion5x/mpp.c  |    5 +++--
>>  3 files changed, 9 insertions(+), 6 deletions(-)
> [...]
> 
> Instead of adding gotos, could you simply replace the 
> "while (*mpp_list)" loop with "for ( ; *mpp_list; mpp_list++)" ?

you'd have to remove the mpp_list++, but this would be in my
view a nicer solution avoiding gotos and any re-occurence of
this in the future.

-- 
Ben

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

end of thread, other threads:[~2010-10-30 22:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-24  8:12 [PATCH] ARM: orion5x/kirkwood/mv78xx0: fix MPP configuration corner cases Mike Rapoport
2010-10-28 13:13 ` Mike Rapoport
2010-10-29  4:12 ` Nicolas Pitre
2010-10-30 22:18   ` Ben Dooks

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.