diff mbox series

[RFT/RFC,37/49] staging: media: zoran: add fallthrough keyword

Message ID 1600683624-5863-38-git-send-email-clabbe@baylibre.com (mailing list archive)
State New, archived
Headers show
Series staging: media: bring back zoran driver | expand

Commit Message

Corentin LABBE Sept. 21, 2020, 10:20 a.m. UTC
This patch adds fallthrough keyword where appropriate.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/staging/media/zoran/zoran_device.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Dan Carpenter Sept. 21, 2020, 10:59 a.m. UTC | #1
On Mon, Sep 21, 2020 at 10:20:12AM +0000, Corentin Labbe wrote:
> This patch adds fallthrough keyword where appropriate.
> 
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  drivers/staging/media/zoran/zoran_device.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c
> index 9558bafdde7d..7634d94f9359 100644
> --- a/drivers/staging/media/zoran/zoran_device.c
> +++ b/drivers/staging/media/zoran/zoran_device.c
> @@ -268,7 +268,9 @@ static void zr36057_adjust_vfe(struct zoran *zr, enum zoran_codec_mode mode)
>  		btwrite(reg, ZR36057_VFEHCR);
>  		break;
>  	case BUZ_MODE_MOTION_COMPRESS:
> +		fallthrough;
>  	case BUZ_MODE_IDLE:
> +		fallthrough;
>  	default:

Hopefully, we don't need fallthrough labels for empty switch statements
like this?

regards,
dan carpenter
Corentin LABBE Sept. 24, 2020, 6:03 p.m. UTC | #2
On Mon, Sep 21, 2020 at 01:59:45PM +0300, Dan Carpenter wrote:
> On Mon, Sep 21, 2020 at 10:20:12AM +0000, Corentin Labbe wrote:
> > This patch adds fallthrough keyword where appropriate.
> > 
> > Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> > ---
> >  drivers/staging/media/zoran/zoran_device.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c
> > index 9558bafdde7d..7634d94f9359 100644
> > --- a/drivers/staging/media/zoran/zoran_device.c
> > +++ b/drivers/staging/media/zoran/zoran_device.c
> > @@ -268,7 +268,9 @@ static void zr36057_adjust_vfe(struct zoran *zr, enum zoran_codec_mode mode)
> >  		btwrite(reg, ZR36057_VFEHCR);
> >  		break;
> >  	case BUZ_MODE_MOTION_COMPRESS:
> > +		fallthrough;
> >  	case BUZ_MODE_IDLE:
> > +		fallthrough;
> >  	default:
> 
> Hopefully, we don't need fallthrough labels for empty switch statements
> like this?
> 

I have removed this patch and nothing warn about fallthrough missing.
But this is strange, if I have added them, it is because something (checkpatch ?) complained.

Anyway, nothing complains now, it is cleaner without them.

Thanks
diff mbox series

Patch

diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c
index 9558bafdde7d..7634d94f9359 100644
--- a/drivers/staging/media/zoran/zoran_device.c
+++ b/drivers/staging/media/zoran/zoran_device.c
@@ -268,7 +268,9 @@  static void zr36057_adjust_vfe(struct zoran *zr, enum zoran_codec_mode mode)
 		btwrite(reg, ZR36057_VFEHCR);
 		break;
 	case BUZ_MODE_MOTION_COMPRESS:
+		fallthrough;
 	case BUZ_MODE_IDLE:
+		fallthrough;
 	default:
 		if ((zr->norm & V4L2_STD_NTSC) ||
 		    (zr->card.type == LML33R10 &&
@@ -521,6 +523,7 @@  static void zr36057_set_jpg(struct zoran *zr, enum zoran_codec_mode mode)
 	/* MJPEG compression mode */
 	switch (mode) {
 	case BUZ_MODE_MOTION_COMPRESS:
+		fallthrough;
 	default:
 		reg = ZR36057_JMC_MJPGCmpMode;
 		break;
@@ -582,6 +585,7 @@  static void zr36057_set_jpg(struct zoran *zr, enum zoran_codec_mode mode)
 	/* NOTE: decimal values here */
 	switch (mode) {
 	case BUZ_MODE_STILL_COMPRESS:
+		fallthrough;
 	case BUZ_MODE_MOTION_COMPRESS:
 		if (zr->card.type != BUZ)
 			reg = 140;
@@ -590,6 +594,7 @@  static void zr36057_set_jpg(struct zoran *zr, enum zoran_codec_mode mode)
 		break;
 
 	case BUZ_MODE_STILL_DECOMPRESS:
+		fallthrough;
 	case BUZ_MODE_MOTION_DECOMPRESS:
 		reg = 20;
 		break;
@@ -827,6 +832,7 @@  void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode)
 		break;
 
 	case BUZ_MODE_IDLE:
+		fallthrough;
 	default:
 		/* shut down processing */
 		btand(~(zr->card.jpeg_int | ZR36057_ICR_JPEGRepIRQ), ZR36057_ICR);