Re: 2.6.18-rc1-mm1: drivers/ide/pci/jmicron.c warning

From: Adrian Bunk
Date: Tue Jul 11 2006 - 19:26:10 EST


On Tue, Jul 11, 2006 at 04:23:28PM -0700, Andrew Morton wrote:
> Alan Cox <alan@xxxxxxxxxx> wrote:
> >
> > I'd say that gcc warning in the case that all the enum values are enumerated
> > and have returns is a broken warning irrespective of that so I won't "fix" it
> > because it isn't broken. Its just like various other bogus gcc warnings
> >
>
> But we work around gcc problems all the time.
>
> Warnings like this have a cost - they make the build noisy and that causes
> people to miss real bugs which the compiler is trying to tell them about.
>
> So if we can implement a low-cost fix for this then we should do so.
>
>
> --- a/drivers/ide/pci/jmicron.c~a
> +++ a/drivers/ide/pci/jmicron.c
> @@ -94,8 +94,9 @@ static int __devinit ata66_jmicron(ide_h
> return 0;
> return 1;
> case PORT_SATA:
> - return 1;
> + break;

The part above isn't required to avoid the warning, and it does IMHO
decrease readability.

> }
> + return 1; /* Avoid bogus "control reaches end of non-void function" */
>...

This is what is required to fix the warning.

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/