public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Missing break in timedia serial setup.
@ 2005-12-07  1:05 Dave Jones
  2005-12-07  9:34 ` Russell King
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Jones @ 2005-12-07  1:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: rmk

Spotted during code review by a Fedora user.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=174967

Signed-off-by: Dave Jones <davej@redhat.com>

--- linux-2.6.14/drivers/serial/8250_pci.c~	2005-12-06 20:01:17.000000000 -0500
+++ linux-2.6.14/drivers/serial/8250_pci.c	2005-12-06 20:01:51.000000000 -0500
@@ -517,6 +517,7 @@ pci_timedia_setup(struct serial_private 
 	case 3:
 		offset = board->uart_offset;
 		bar = 1;
+		break;
 	case 4: /* BAR 2 */
 	case 5: /* BAR 3 */
 	case 6: /* BAR 4 */

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

* Re: Missing break in timedia serial setup.
  2005-12-07  1:05 Missing break in timedia serial setup Dave Jones
@ 2005-12-07  9:34 ` Russell King
  2005-12-07 16:58   ` Dave Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King @ 2005-12-07  9:34 UTC (permalink / raw)
  To: Dave Jones, linux-kernel

On Tue, Dec 06, 2005 at 08:05:26PM -0500, Dave Jones wrote:
> Spotted during code review by a Fedora user.
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=174967

Makes no difference.

        switch (idx) {
        case 3:
                bar = 1;
        case 4: /* BAR 2 */
        case 5: /* BAR 3 */
        case 6: /* BAR 4 */
        case 7: /* BAR 5 */
                bar = idx - 2;

If idx is 3, idx - 2 is 1.  So the bar = 1 is actually redundant in
case 3.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

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

* Re: Missing break in timedia serial setup.
  2005-12-07  9:34 ` Russell King
@ 2005-12-07 16:58   ` Dave Jones
  2005-12-07 17:05     ` Arjan van de Ven
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Jones @ 2005-12-07 16:58 UTC (permalink / raw)
  To: linux-kernel

On Wed, Dec 07, 2005 at 09:34:31AM +0000, Russell King wrote:
 > On Tue, Dec 06, 2005 at 08:05:26PM -0500, Dave Jones wrote:
 > > Spotted during code review by a Fedora user.
 > > https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=174967
 > 
 > Makes no difference.
 > 
 >         switch (idx) {
 >         case 3:
 >                 bar = 1;
 >         case 4: /* BAR 2 */
 >         case 5: /* BAR 3 */
 >         case 6: /* BAR 4 */
 >         case 7: /* BAR 5 */
 >                 bar = idx - 2;
 > 
 > If idx is 3, idx - 2 is 1.  So the bar = 1 is actually redundant in
 > case 3.

Duh, yes of course. Here's a patch to remove the redundant assignment,
but as it's harmless, I'll leave it up to you to decide whether or
not it's worth applying.

Signed-off-by: Dave Jones <davej@redhat.com>

--- linux-2.6.14/drivers/serial/8250_pci.c~	2005-12-07 11:56:13.000000000 -0500
+++ linux-2.6.14/drivers/serial/8250_pci.c	2005-12-07 11:56:41.000000000 -0500
@@ -516,7 +516,6 @@ pci_timedia_setup(struct serial_private 
 		break;
 	case 3:
 		offset = board->uart_offset;
-		bar = 1;
 	case 4: /* BAR 2 */
 	case 5: /* BAR 3 */
 	case 6: /* BAR 4 */

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

* Re: Missing break in timedia serial setup.
  2005-12-07 16:58   ` Dave Jones
@ 2005-12-07 17:05     ` Arjan van de Ven
  2005-12-07 17:44       ` Dave Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Arjan van de Ven @ 2005-12-07 17:05 UTC (permalink / raw)
  To: Dave Jones; +Cc: linux-kernel


> 
> Signed-off-by: Dave Jones <davej@redhat.com>
> 
> --- linux-2.6.14/drivers/serial/8250_pci.c~	2005-12-07 11:56:13.000000000 -0500
> +++ linux-2.6.14/drivers/serial/8250_pci.c	2005-12-07 11:56:41.000000000 -0500
> @@ -516,7 +516,6 @@ pci_timedia_setup(struct serial_private 
>  		break;
>  	case 3:
>  		offset = board->uart_offset;
> -		bar = 1;
>  	case 4: /* BAR 2 */
>  	case 5: /* BAR 3 */
>  	case 6: /* BAR 4 */
> -

might as well add a /* fall through */ comment
so that this doesn't come up again in the future..



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

* Re: Missing break in timedia serial setup.
  2005-12-07 17:05     ` Arjan van de Ven
@ 2005-12-07 17:44       ` Dave Jones
  2005-12-07 18:11         ` Russell King
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Jones @ 2005-12-07 17:44 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

On Wed, Dec 07, 2005 at 06:05:19PM +0100, Arjan van de Ven wrote:

 > might as well add a /* fall through */ comment
 > so that this doesn't come up again in the future..

Remove redundant assignment, and mark fallthrough.
 
Signed-off-by: Dave Jones <davej@redhat.com>

--- linux-2.6.14/drivers/serial/8250_pci.c~	2005-12-07 12:42:58.000000000 -0500
+++ linux-2.6.14/drivers/serial/8250_pci.c	2005-12-07 12:43:08.000000000 -0500
@@ -516,7 +516,7 @@ pci_timedia_setup(struct serial_private 
 		break;
 	case 3:
 		offset = board->uart_offset;
-		bar = 1;
+		/* FALLTHROUGH */
 	case 4: /* BAR 2 */
 	case 5: /* BAR 3 */
 	case 6: /* BAR 4 */

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

* Re: Missing break in timedia serial setup.
  2005-12-07 17:44       ` Dave Jones
@ 2005-12-07 18:11         ` Russell King
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King @ 2005-12-07 18:11 UTC (permalink / raw)
  To: Dave Jones, Arjan van de Ven, linux-kernel

On Wed, Dec 07, 2005 at 12:44:09PM -0500, Dave Jones wrote:
> On Wed, Dec 07, 2005 at 06:05:19PM +0100, Arjan van de Ven wrote:
> 
>  > might as well add a /* fall through */ comment
>  > so that this doesn't come up again in the future..
> 
> Remove redundant assignment, and mark fallthrough.

Thanks Dave, committed.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

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

end of thread, other threads:[~2005-12-07 18:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-07  1:05 Missing break in timedia serial setup Dave Jones
2005-12-07  9:34 ` Russell King
2005-12-07 16:58   ` Dave Jones
2005-12-07 17:05     ` Arjan van de Ven
2005-12-07 17:44       ` Dave Jones
2005-12-07 18:11         ` Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox