All of lore.kernel.org
 help / color / mirror / Atom feed
From: <dan.carpenter@oracle.com>
To: dave.jiang@intel.com
Cc: dmaengine@vger.kernel.org
Subject: [bug report] dmaengine: check device and channel list for empty
Date: Thu, 9 Jul 2020 12:10:29 +0300	[thread overview]
Message-ID: <20200709091029.GA10135@mwanda> (raw)

Hello Dave Jiang,

The patch deb9541f5052: "dmaengine: check device and channel list for
empty" from Jun 26, 2020, leads to the following static checker
warnings:

drivers/mmc/host/omap_hsmmc.c:1959 omap_hsmmc_probe() warn: 'host->rx_chan' can also be NULL
drivers/mmc/host/omap_hsmmc.c:1959 omap_hsmmc_probe() warn: 'host->tx_chan' can also be NULL
drivers/media/platform/xilinx/xilinx-dma.c:736 xvip_dma_init() warn: 'dma->dma' can also be NULL
drivers/spi/spi-fsl-dspi.c:520 dspi_request_dma() warn: 'dma->chan_tx' can also be NULL
drivers/spi/spi-fsl-dspi.c:528 dspi_request_dma() warn: 'dma->chan_rx' can also be NULL
drivers/iio/adc/ti_am335x_adc.c:565 tiadc_request_dma() warn: 'dma->chan' can also be NULL
drivers/iio/adc/stm32-dfsdm-adc.c:1381 stm32_dfsdm_dma_request() warn: 'adc->dma_chan' can also be NULL
drivers/iio/adc/stm32-adc.c:1837 stm32_adc_dma_request() warn: 'adc->dma_chan' can also be NULL
drivers/iio/adc/at91-sama5d2_adc.c:1520 at91_adc_dma_init() warn: 'st->dma_st.dma_chan' can also be NULL
sound/soc/ti/davinci-mcasp.c:1902 davinci_mcasp_get_dma_type() warn: 'chan' can also be NULL

drivers/mmc/host/omap_hsmmc.c
  1937  
  1938          host->rx_chan = dma_request_chan(&pdev->dev, "rx");
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The dma_request_chan() function used to only return error pointers or
a valid pointer.  We need to update the comments at the start of the
function to explain about the new NULL return.

  1939          if (IS_ERR(host->rx_chan)) {
  1940                  dev_err(mmc_dev(host->mmc), "RX DMA channel request failed\n");
  1941                  ret = PTR_ERR(host->rx_chan);
  1942                  goto err_irq;
  1943          }
  1944  
  1945          host->tx_chan = dma_request_chan(&pdev->dev, "tx");
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1946          if (IS_ERR(host->tx_chan)) {
  1947                  dev_err(mmc_dev(host->mmc), "TX DMA channel request failed\n");
  1948                  ret = PTR_ERR(host->tx_chan);
  1949                  goto err_irq;
  1950          }
  1951  
  1952          /*
  1953           * Limit the maximum segment size to the lower of the request size
  1954           * and the DMA engine device segment size limits.  In reality, with
  1955           * 32-bit transfers, the DMA engine can do longer segments than this
  1956           * but there is no way to represent that in the DMA model - if we
  1957           * increase this figure here, we get warnings from the DMA API debug.
  1958           */
  1959          mmc->max_seg_size = min3(mmc->max_req_size,
  1960                          dma_get_max_seg_size(host->rx_chan->device->dev),
                                                     ^^^^^^^^^^^^^^^
This will Oops.

  1961                          dma_get_max_seg_size(host->tx_chan->device->dev));
  1962  
  1963          /* Request IRQ for MMC operations */
  1964          ret = devm_request_irq(&pdev->dev, host->irq, omap_hsmmc_irq, 0,
  1965                          mmc_hostname(mmc), host);
  1966          if (ret) {
  1967                  dev_err(mmc_dev(host->mmc), "Unable to grab HSMMC IRQ\n");

regards,
dan carpenter

                 reply	other threads:[~2020-07-09  9:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200709091029.GA10135@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    /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.