Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1318052 > unrolled thread

[PATCH v2] mmc: omap_hsmmc: don't print uninitialized variables

Started byArnd Bergmann <arnd@arndb.de>
First post2016-01-26 16:30 +0100
Last post2016-01-27 09:20 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] mmc: omap_hsmmc: don't print uninitialized variables Arnd Bergmann <arnd@arndb.de> - 2016-01-26 16:30 +0100
    Re: [PATCH v2] mmc: omap_hsmmc: don't print uninitialized variables Tony Lindgren <tony@atomide.com> - 2016-01-26 20:40 +0100
    Re: [PATCH v2] mmc: omap_hsmmc: don't print uninitialized variables Peter Ujfalusi <peter.ujfalusi@ti.com> - 2016-01-27 09:20 +0100

#1318052 — [PATCH v2] mmc: omap_hsmmc: don't print uninitialized variables

FromArnd Bergmann <arnd@arndb.de>
Date2016-01-26 16:30 +0100
Subject[PATCH v2] mmc: omap_hsmmc: don't print uninitialized variables
Message-ID<qVdJ8-5Zk-11@gated-at.bofh.it>
When DT based probing is used but the DMA request fails, the
driver will print uninitialized stack data from the rx_req
and tx_req variables, as indicated by this warning:

drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_probe':
drivers/mmc/host/omap_hsmmc.c:2162:3: warning: 'rx_req' may be used uninitialized in this function [-Wmaybe-uninitialized]
   dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req);

This removes the DMA request line number from the warning, which
is the easiest solution and won't hurt us any more as we are
planning to remove the legacy code path anyway.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
A simpler patch as v1 with the same result, as suggested by Peter Ujfalusi.

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index b6639ea0bf18..87f0d840a166 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2159,7 +2159,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 						 &rx_req, &pdev->dev, "rx");
 
 	if (!host->rx_chan) {
-		dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req);
+		dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel\n");
 		ret = -ENXIO;
 		goto err_irq;
 	}
@@ -2169,7 +2169,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 						 &tx_req, &pdev->dev, "tx");
 
 	if (!host->tx_chan) {
-		dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel %u\n", tx_req);
+		dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel\n");
 		ret = -ENXIO;
 		goto err_irq;
 	}

[toc] | [next] | [standalone]


#1318314

FromTony Lindgren <tony@atomide.com>
Date2016-01-26 20:40 +0100
Message-ID<qVhD4-nw-23@gated-at.bofh.it>
In reply to#1318052
* Arnd Bergmann <arnd@arndb.de> [160126 07:28]:
> When DT based probing is used but the DMA request fails, the
> driver will print uninitialized stack data from the rx_req
> and tx_req variables, as indicated by this warning:
> 
> drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_probe':
> drivers/mmc/host/omap_hsmmc.c:2162:3: warning: 'rx_req' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req);
> 
> This removes the DMA request line number from the warning, which
> is the easiest solution and won't hurt us any more as we are
> planning to remove the legacy code path anyway.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> A simpler patch as v1 with the same result, as suggested by Peter Ujfalusi.

Looks OK to me:

Acked-by: Tony Lindgren <tony@atomide.com>

> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index b6639ea0bf18..87f0d840a166 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -2159,7 +2159,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
>  						 &rx_req, &pdev->dev, "rx");
>  
>  	if (!host->rx_chan) {
> -		dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req);
> +		dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel\n");
>  		ret = -ENXIO;
>  		goto err_irq;
>  	}
> @@ -2169,7 +2169,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
>  						 &tx_req, &pdev->dev, "tx");
>  
>  	if (!host->tx_chan) {
> -		dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel %u\n", tx_req);
> +		dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel\n");
>  		ret = -ENXIO;
>  		goto err_irq;
>  	}
> 

[toc] | [prev] | [next] | [standalone]


#1318744

FromPeter Ujfalusi <peter.ujfalusi@ti.com>
Date2016-01-27 09:20 +0100
Message-ID<qVtux-zV-7@gated-at.bofh.it>
In reply to#1318052
On 01/26/2016 05:26 PM, Arnd Bergmann wrote:
> When DT based probing is used but the DMA request fails, the
> driver will print uninitialized stack data from the rx_req
> and tx_req variables, as indicated by this warning:
> 
> drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_probe':
> drivers/mmc/host/omap_hsmmc.c:2162:3: warning: 'rx_req' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req);
> 
> This removes the DMA request line number from the warning, which
> is the easiest solution and won't hurt us any more as we are
> planning to remove the legacy code path anyway.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> A simpler patch as v1 with the same result, as suggested by Peter Ujfalusi.

Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index b6639ea0bf18..87f0d840a166 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -2159,7 +2159,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
>  						 &rx_req, &pdev->dev, "rx");
>  
>  	if (!host->rx_chan) {
> -		dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req);
> +		dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel\n");
>  		ret = -ENXIO;
>  		goto err_irq;
>  	}
> @@ -2169,7 +2169,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
>  						 &tx_req, &pdev->dev, "tx");
>  
>  	if (!host->tx_chan) {
> -		dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel %u\n", tx_req);
> +		dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel\n");
>  		ret = -ENXIO;
>  		goto err_irq;
>  	}
> 


-- 
Péter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web