Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Ulf Hansson <ulf.hansson@linaro.org>, <linux-mmc@vger.kernel.org>
Subject: [PATCH] mmc: renesas_sdhi_sys_dmac: use DMA_SLAVE_BUSWIDTH_UNDEFINED
Date: Fri, 21 Jan 2022 23:38:33 +0300	[thread overview]
Message-ID: <5e22c587-5698-e132-4429-48674a6ddbb7@omp.ru> (raw)

The 'dma_slave_config::{src|dst}_addr_width' fields have the *enum* type
which isn't isomorphic with the *bool* type, however is used as a boolean
expression. Use the *enum* dma_slave_buswidth's value corresponding to 0
instead.

Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
This patch is against the 'next' branch of Ulf Hansson's 'mmc.git' repo.

drivers/mmc/host/renesas_sdhi_sys_dmac.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: mmc/drivers/mmc/host/renesas_sdhi_sys_dmac.c
===================================================================
--- mmc.orig/drivers/mmc/host/renesas_sdhi_sys_dmac.c
+++ mmc/drivers/mmc/host/renesas_sdhi_sys_dmac.c
@@ -370,7 +370,7 @@ static void renesas_sdhi_sys_dmac_reques
 		cfg.dst_addr = res->start +
 			(CTL_SD_DATA_PORT << host->bus_shift);
 		cfg.dst_addr_width = priv->dma_priv.dma_buswidth;
-		if (!cfg.dst_addr_width)
+		if (cfg.dst_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED)
 			cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 		cfg.src_addr = 0;
 		ret = dmaengine_slave_config(host->chan_tx, &cfg);
@@ -389,7 +389,7 @@ static void renesas_sdhi_sys_dmac_reques
 		cfg.direction = DMA_DEV_TO_MEM;
 		cfg.src_addr = cfg.dst_addr + host->pdata->dma_rx_offset;
 		cfg.src_addr_width = priv->dma_priv.dma_buswidth;
-		if (!cfg.src_addr_width)
+		if (cfg.src_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED)
 			cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 		cfg.dst_addr = 0;
 		ret = dmaengine_slave_config(host->chan_rx, &cfg);

             reply	other threads:[~2022-01-21 20:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 20:38 Sergey Shtylyov [this message]
2022-01-31 16:26 ` [PATCH] mmc: renesas_sdhi_sys_dmac: use DMA_SLAVE_BUSWIDTH_UNDEFINED Ulf Hansson
2022-02-02  4:13   ` Vinod Koul

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=5e22c587-5698-e132-4429-48674a6ddbb7@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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