From e008227eb34fe14eb5fdb1ca2a07ac018dd9f22a Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Mon, 29 Jul 2019 17:45:19 -0500 Subject: [PATCH 1/2] HSI: ssi_protocol: Mark expected switch fall-throughs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mark switch cases where we are expecting to fall through. This patch fixes the following warning (Building: arm): drivers/hsi/clients/ssi_protocol.c: In function ‘ssip_set_rxstate’: drivers/hsi/clients/ssi_protocol.c:291:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (atomic_read(&ssi->tx_usecnt)) ^ drivers/hsi/clients/ssi_protocol.c:294:2: note: here case RECEIVING: ^~~~ drivers/hsi/clients/ssi_protocol.c: In function ‘ssip_keep_alive’: drivers/hsi/clients/ssi_protocol.c:466:7: warning: this statement may fall through [-Wimplicit-fallthrough=] if (atomic_read(&ssi->tx_usecnt) == 0) ^ drivers/hsi/clients/ssi_protocol.c:472:3: note: here case SEND_IDLE: ^~~~ Notice that, in this particular case, the code comment is modified in accordance with what GCC is expecting to find. Signed-off-by: Gustavo A. R. Silva Signed-off-by: Sebastian Reichel --- drivers/hsi/clients/ssi_protocol.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c index 9aeed98b87a1..504d00ec1ea7 100644 --- a/drivers/hsi/clients/ssi_protocol.c +++ b/drivers/hsi/clients/ssi_protocol.c @@ -290,7 +290,7 @@ static void ssip_set_rxstate(struct ssi_protocol *ssi, unsigned int state) /* CMT speech workaround */ if (atomic_read(&ssi->tx_usecnt)) break; - /* Otherwise fall through */ + /* Else, fall through */ case RECEIVING: mod_timer(&ssi->keep_alive, jiffies + msecs_to_jiffies(SSIP_KATOUT)); @@ -465,9 +465,10 @@ static void ssip_keep_alive(struct timer_list *t) case SEND_READY: if (atomic_read(&ssi->tx_usecnt) == 0) break; + /* Fall through */ /* - * Fall through. Workaround for cmt-speech - * in that case we relay on audio timers. + * Workaround for cmt-speech in that case + * we relay on audio timers. */ case SEND_IDLE: spin_unlock(&ssi->lock); From c1030cd456198a2c58f718c3c4b215698d635553 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Tue, 30 Jul 2019 11:15:16 -0700 Subject: [PATCH 2/2] HSI: Remove dev_err() usage after platform_get_irq() We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // While we're here, remove braces on if statements that only have one statement (manually). Cc: Sebastian Reichel Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd Signed-off-by: Sebastian Reichel --- drivers/hsi/controllers/omap_ssi_core.c | 4 +--- drivers/hsi/controllers/omap_ssi_port.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c index 0cba567ee2d7..4bc4a201f0f6 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c @@ -370,10 +370,8 @@ static int ssi_add_controller(struct hsi_controller *ssi, if (err < 0) goto out_err; err = platform_get_irq_byname(pd, "gdd_mpu"); - if (err < 0) { - dev_err(&pd->dev, "GDD IRQ resource missing\n"); + if (err < 0) goto out_err; - } omap_ssi->gdd_irq = err; tasklet_init(&omap_ssi->gdd_tasklet, ssi_gdd_tasklet, (unsigned long)ssi); diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c index 2cd93119515f..a0cb5be246e1 100644 --- a/drivers/hsi/controllers/omap_ssi_port.c +++ b/drivers/hsi/controllers/omap_ssi_port.c @@ -1038,10 +1038,8 @@ static int ssi_port_irq(struct hsi_port *port, struct platform_device *pd) int err; err = platform_get_irq(pd, 0); - if (err < 0) { - dev_err(&port->device, "Port IRQ resource missing\n"); + if (err < 0) return err; - } omap_port->irq = err; err = devm_request_threaded_irq(&port->device, omap_port->irq, NULL, ssi_pio_thread, IRQF_ONESHOT, "SSI PORT", port);