All of lore.kernel.org
 help / color / mirror / Atom feed
From: Balaji T K <balajitk@ti.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Matt Porter <matt.porter@linaro.org>, Chris Ball <cjb@laptop.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	Vinod Koul <vinod.koul@intel.com>,
	Tony Lindgren <tony@atomide.com>,
	Linux OMAP List <linux-omap@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux MMC List <linux-mmc@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>
Subject: Re: Uninitialized rx_req/tx_req (was: Re: [PATCH v2 2/3] mmc: omap_hsmmc: Skip platform_get_resource_byname() for dt case)
Date: Thu, 12 Sep 2013 20:41:48 +0530	[thread overview]
Message-ID: <5231D9B4.5000308@ti.com> (raw)
In-Reply-To: <CAMuHMdVVjkZBZyJe2qnUxHeRVo+8WD_Vx1ZKin_pA7XLRCW8uw@mail.gmail.com>

On Thursday 12 September 2013 06:11 PM, Geert Uytterhoeven wrote:
> On Tue, Mar 5, 2013 at 10:13 PM, Matt Porter <mporter@ti.com> wrote:
>> From: Santosh Shilimkar <santosh.shilimkar@ti.com>
>>
>> MMC driver probe will abort for DT case because of failed
>> platform_get_resource_byname() lookup. Fix it by skipping resource
>> byname lookup for device tree build.
>>
>> Issue is hidden because hwmod popullates the IO resources which
>> helps to succeed platform_get_resource_byname() and probe.
>>
>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> ---
>>   drivers/mmc/host/omap_hsmmc.c |   28 +++++++++++++++-------------
>>   1 file changed, 15 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index e79b12d..8ae1225 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -1896,21 +1896,23 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
>>
>>          omap_hsmmc_conf_bus_power(host);
>>
>> -       res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
>> -       if (!res) {
>> -               dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n");
>> -               ret = -ENXIO;
>> -               goto err_irq;
>> -       }
>> -       tx_req = res->start;
>> +       if (!pdev->dev.of_node) {
>> +               res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
>> +               if (!res) {
>> +                       dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n");
>> +                       ret = -ENXIO;
>> +                       goto err_irq;
>> +               }
>> +               tx_req = res->start;
>>
>> -       res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
>> -       if (!res) {
>> -               dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n");
>> -               ret = -ENXIO;
>> -               goto err_irq;
>> +               res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
>> +               if (!res) {
>> +                       dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n");
>> +                       ret = -ENXIO;
>> +                       goto err_irq;
>> +               }
>> +               rx_req = res->start;
>>          }
>> -       rx_req = res->start;
>>
>>          dma_cap_zero(mask);
>>          dma_cap_set(DMA_SLAVE, mask);
>
> Now this is in mainline, I get (gcc 4.1.2):
>
> drivers/mmc/host/omap_hsmmc.c: In function ‘omap_hsmmc_probe’:
> drivers/mmc/host/omap_hsmmc.c:1779: warning: ‘rx_req’ may be used
> uninitialized in this function
> drivers/mmc/host/omap_hsmmc.c:1779: warning: ‘tx_req’ may be used
> uninitialized in this function
>
> Indeed, rx_req and tx_req are not initialized in the DT case.
>
> Initializing them to zero is probably not the right fix. Where are the values
> supposed to come from in the DT case?
>
Hi,

rx_req and tx_req are not used in DT case [1].
dma_request_slave_channel is used to get dma info from mmc dt node.

__dma_request_channel is fallback case for non dt boot.

Note __dma_request_channel is called if dma info is not populated in
dts files.

static inline struct dma_chan
*__dma_request_slave_channel_compat(const dma_cap_mask_t *mask,
				  dma_filter_fn fn, void *fn_param,
				  struct device *dev, char *name)
{
	struct dma_chan *chan;

	chan = dma_request_slave_channel(dev, name);
	if (chan)
		return chan;

	return __dma_request_channel(mask, fn, fn_param);
}

> 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
>

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Balaji T K <balajitk@ti.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Matt Porter <matt.porter@linaro.org>, Chris Ball <cjb@laptop.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	Vinod Koul <vinod.koul@intel.com>,
	Tony Lindgren <tony@atomide.com>,
	Linux OMAP List <linux-omap@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux MMC List <linux-mmc@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>
Subject: Re: Uninitialized rx_req/tx_req (was: Re: [PATCH v2 2/3] mmc: omap_hsmmc: Skip platform_get_resource_byname() for dt case)
Date: Thu, 12 Sep 2013 20:41:48 +0530	[thread overview]
Message-ID: <5231D9B4.5000308@ti.com> (raw)
In-Reply-To: <CAMuHMdVVjkZBZyJe2qnUxHeRVo+8WD_Vx1ZKin_pA7XLRCW8uw@mail.gmail.com>

On Thursday 12 September 2013 06:11 PM, Geert Uytterhoeven wrote:
> On Tue, Mar 5, 2013 at 10:13 PM, Matt Porter <mporter@ti.com> wrote:
>> From: Santosh Shilimkar <santosh.shilimkar@ti.com>
>>
>> MMC driver probe will abort for DT case because of failed
>> platform_get_resource_byname() lookup. Fix it by skipping resource
>> byname lookup for device tree build.
>>
>> Issue is hidden because hwmod popullates the IO resources which
>> helps to succeed platform_get_resource_byname() and probe.
>>
>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> ---
>>   drivers/mmc/host/omap_hsmmc.c |   28 +++++++++++++++-------------
>>   1 file changed, 15 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index e79b12d..8ae1225 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -1896,21 +1896,23 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
>>
>>          omap_hsmmc_conf_bus_power(host);
>>
>> -       res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
>> -       if (!res) {
>> -               dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n");
>> -               ret = -ENXIO;
>> -               goto err_irq;
>> -       }
>> -       tx_req = res->start;
>> +       if (!pdev->dev.of_node) {
>> +               res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
>> +               if (!res) {
>> +                       dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n");
>> +                       ret = -ENXIO;
>> +                       goto err_irq;
>> +               }
>> +               tx_req = res->start;
>>
>> -       res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
>> -       if (!res) {
>> -               dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n");
>> -               ret = -ENXIO;
>> -               goto err_irq;
>> +               res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
>> +               if (!res) {
>> +                       dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n");
>> +                       ret = -ENXIO;
>> +                       goto err_irq;
>> +               }
>> +               rx_req = res->start;
>>          }
>> -       rx_req = res->start;
>>
>>          dma_cap_zero(mask);
>>          dma_cap_set(DMA_SLAVE, mask);
>
> Now this is in mainline, I get (gcc 4.1.2):
>
> drivers/mmc/host/omap_hsmmc.c: In function ‘omap_hsmmc_probe’:
> drivers/mmc/host/omap_hsmmc.c:1779: warning: ‘rx_req’ may be used
> uninitialized in this function
> drivers/mmc/host/omap_hsmmc.c:1779: warning: ‘tx_req’ may be used
> uninitialized in this function
>
> Indeed, rx_req and tx_req are not initialized in the DT case.
>
> Initializing them to zero is probably not the right fix. Where are the values
> supposed to come from in the DT case?
>
Hi,

rx_req and tx_req are not used in DT case [1].
dma_request_slave_channel is used to get dma info from mmc dt node.

__dma_request_channel is fallback case for non dt boot.

Note __dma_request_channel is called if dma info is not populated in
dts files.

static inline struct dma_chan
*__dma_request_slave_channel_compat(const dma_cap_mask_t *mask,
				  dma_filter_fn fn, void *fn_param,
				  struct device *dev, char *name)
{
	struct dma_chan *chan;

	chan = dma_request_slave_channel(dev, name);
	if (chan)
		return chan;

	return __dma_request_channel(mask, fn, fn_param);
}

> 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
>


  parent reply	other threads:[~2013-09-12 15:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 12:41 Uninitialized rx_req/tx_req (was: Re: [PATCH v2 2/3] mmc: omap_hsmmc: Skip platform_get_resource_byname() for dt case) Geert Uytterhoeven
2013-09-12 12:41 ` Geert Uytterhoeven
2013-09-12 15:10 ` Balaji T K
2013-09-12 15:10   ` Balaji T K
2013-09-12 15:11 ` Balaji T K [this message]
2013-09-12 15:11   ` Balaji T K

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=5231D9B4.5000308@ti.com \
    --to=balajitk@ti.com \
    --cc=arnd@arndb.de \
    --cc=cjb@laptop.org \
    --cc=geert@linux-m68k.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=matt.porter@linaro.org \
    --cc=rob.herring@calxeda.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=tony@atomide.com \
    --cc=vinod.koul@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.