[PATCH] dmaengine: sh: rz_dmac: remove braces around single statement if block

Cosmin Tanislav posted 1 patch 3 months, 2 weeks ago
drivers/dma/sh/rz-dmac.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
[PATCH] dmaengine: sh: rz_dmac: remove braces around single statement if block
Posted by Cosmin Tanislav 3 months, 2 weeks ago
Braces around single statement if blocks are unnecessary, remove them.

Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
---
 drivers/dma/sh/rz-dmac.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index 1f687b08d6b8..a6db74e86c18 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -336,13 +336,12 @@ static void rz_dmac_prepare_desc_for_memcpy(struct rz_dmac_chan *channel)
 	lmdesc->chext = 0;
 	lmdesc->header = HEADER_LV;
 
-	if (dmac->has_icu) {
+	if (dmac->has_icu)
 		rzv2h_icu_register_dma_req(dmac->icu.pdev, dmac->icu.dmac_index,
 					   channel->index,
 					   RZV2H_ICU_DMAC_REQ_NO_DEFAULT);
-	} else {
+	else
 		rz_dmac_set_dmars_register(dmac, channel->index, 0);
-	}
 
 	channel->chcfg = chcfg;
 	channel->chctrl = CHCTRL_STG | CHCTRL_SETEN;
@@ -393,12 +392,11 @@ static void rz_dmac_prepare_descs_for_slave_sg(struct rz_dmac_chan *channel)
 
 	channel->lmdesc.tail = lmdesc;
 
-	if (dmac->has_icu) {
+	if (dmac->has_icu)
 		rzv2h_icu_register_dma_req(dmac->icu.pdev, dmac->icu.dmac_index,
 					   channel->index, channel->mid_rid);
-	} else {
+	else
 		rz_dmac_set_dmars_register(dmac, channel->index, channel->mid_rid);
-	}
 
 	channel->chctrl = CHCTRL_SETEN;
 }
@@ -671,13 +669,12 @@ static void rz_dmac_device_synchronize(struct dma_chan *chan)
 	if (ret < 0)
 		dev_warn(dmac->dev, "DMA Timeout");
 
-	if (dmac->has_icu) {
+	if (dmac->has_icu)
 		rzv2h_icu_register_dma_req(dmac->icu.pdev, dmac->icu.dmac_index,
 					   channel->index,
 					   RZV2H_ICU_DMAC_REQ_NO_DEFAULT);
-	} else {
+	else
 		rz_dmac_set_dmars_register(dmac, channel->index, 0);
-	}
 }
 
 /*
-- 
2.51.1.dirty
Re: [PATCH] dmaengine: sh: rz_dmac: remove braces around single statement if block
Posted by Geert Uytterhoeven 3 months, 2 weeks ago
Hi Cosmin,

On Wed, 22 Oct 2025 at 09:39, Cosmin Tanislav
<cosmin-gabriel.tanislav.xa@renesas.com> wrote:
> Braces around single statement if blocks are unnecessary, remove them.
>
> Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -336,13 +336,12 @@ static void rz_dmac_prepare_desc_for_memcpy(struct rz_dmac_chan *channel)
>         lmdesc->chext = 0;
>         lmdesc->header = HEADER_LV;
>
> -       if (dmac->has_icu) {
> +       if (dmac->has_icu)
>                 rzv2h_icu_register_dma_req(dmac->icu.pdev, dmac->icu.dmac_index,
>                                            channel->index,
>                                            RZV2H_ICU_DMAC_REQ_NO_DEFAULT);
> -       } else {
> +       else
>                 rz_dmac_set_dmars_register(dmac, channel->index, 0);
> -       }

Seeing this same construct being repeated three times, I think it
would be good to introduce a helper (in a separate patch, of course).

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds