From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/6] [RFC] mtd: mxc-nand: Warn on unimplemented commands
Date: Wed, 11 Feb 2015 10:48:40 +0100 [thread overview]
Message-ID: <20150211094840.GN12209@pengutronix.de> (raw)
In-Reply-To: <20150211104016.0d7eec4d@ipc1.ka-ro>
On Wed, Feb 11, 2015 at 10:40:16AM +0100, Lothar Wa?mann wrote:
> 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.
The 'default:' is not necessarily at the end. Dropping the 'break' in
the last case makes it easy to forget to add the break when additional
cases are added below the last one.
IMO the 'break' should stay there.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2015-02-11 9:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-10 18:59 [PATCH 0/6] mtd: teach mxc-nand about ONFI probing Uwe Kleine-König
2015-02-10 18:59 ` [PATCH 1/6] mtd: mxc-nand: Add a timeout when waiting for interrupt Uwe Kleine-König
2015-02-10 18:59 ` [PATCH 2/6] mtd: mxc-nand: Only enable hardware checksumming for fully detected flashes Uwe Kleine-König
2015-02-10 18:59 ` [PATCH 3/6] mtd: mxc-nand: Do the word to byte mangling in the read_byte callback Uwe Kleine-König
2015-02-10 18:59 ` [PATCH 4/6] mtd: mxc-nand: Allow to use column addresses different from 0 Uwe Kleine-König
2015-02-10 18:59 ` [PATCH 5/6] mtd: mxc-nand: Implement support for PARAM command Uwe Kleine-König
2015-02-10 19:00 ` [PATCH 6/6] [RFC] mtd: mxc-nand: Warn on unimplemented commands Uwe Kleine-König
2015-02-11 8:42 ` Lothar Waßmann
2015-02-11 9:00 ` Uwe Kleine-König
2015-02-11 9:40 ` Lothar Waßmann
2015-02-11 9:48 ` Uwe Kleine-König
2015-02-11 9:48 ` Sascha Hauer [this message]
2015-03-02 16:31 ` [PATCH 0/6] mtd: teach mxc-nand about ONFI probing Uwe Kleine-König
2015-03-11 23:42 ` Brian Norris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150211094840.GN12209@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).