[PATCH 6/6] [RFC] mtd: mxc-nand: Warn on unimplemented commands

Lothar Waßmann LW at KARO-electronics.de
Wed Feb 11 01:40:16 PST 2015


Hi,

Uwe Kleine-König wrote:
> Hello Lothar,
> 
> On Wed, Feb 11, 2015 at 09:42:56AM +0100, Lothar Waßmann wrote:
> > > diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> > > index 0083b4ee4f33..372e0e38f59b 100644
> > > --- a/drivers/mtd/nand/mxc_nand.c
> > > +++ b/drivers/mtd/nand/mxc_nand.c
> > > @@ -1160,6 +1160,10 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
> > >  		memcpy32_fromio(host->data_buf, host->main_area0, 512);
> > >  		host->buf_start = 0;
> > >  		break;
> > > +	default:
> > > +		WARN_ONCE(1, "Unimplemented command (cmd=%u)\n",
> > > +			  command);
> > > +		break;
> > >  	}
> > useless break;
> Do you mean the line break? That's right, I fixed it here for a later
> v2. But I guess you mean the (literal) break here. Right, it could be
> dropped without change in semantic, but I thought adding it matches the
> usually recommended style?!
> 
Documentation/CodingStyle has this example:
|        default:
|                break;
|        }
but there is no useful statement in the 'default' case, so the
'break' is necessary here.
IMO this doesn't mandate to add a 'break' at the end of the default
clause if there are actual statements in this path.


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________



More information about the linux-arm-kernel mailing list