All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: shubhrajyoti-l0cyMroinI0@public.gmane.org
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: re: spi: omap2-mcspi: Cleanup the omap2_mcspi_txrx_dma function
Date: Fri, 11 Apr 2014 14:20:21 +0300	[thread overview]
Message-ID: <20140411112021.GA9166@mwanda> (raw)

Hello Shubhrajyoti D,

This is a semi-automatic email about new static checker warnings.

The patch d7b4394e780b: "spi: omap2-mcspi: Cleanup the 
omap2_mcspi_txrx_dma function" from Sep 11, 2012, leads to the 
following Smatch complaint:

drivers/spi/spi-omap2-mcspi.c:425 omap2_mcspi_tx_dma()
	 error: we previously assumed 'mcspi_dma->dma_tx' could be null (see line 405)

drivers/spi/spi-omap2-mcspi.c
   404	
   405		if (mcspi_dma->dma_tx) {
                    ^^^^^^^^^^^^^^^^^
Check for NULL.

   406			struct dma_async_tx_descriptor *tx;
   407			struct scatterlist sg;
   408	
   409			dmaengine_slave_config(mcspi_dma->dma_tx, &cfg);
   410	
   411			sg_init_table(&sg, 1);
   412			sg_dma_address(&sg) = xfer->tx_dma;
   413			sg_dma_len(&sg) = xfer->len;
   414	
   415			tx = dmaengine_prep_slave_sg(mcspi_dma->dma_tx, &sg, 1,
   416			DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
   417			if (tx) {
   418				tx->callback = omap2_mcspi_tx_callback;
   419				tx->callback_param = spi;
   420				dmaengine_submit(tx);
   421			} else {
   422				/* FIXME: fall back to PIO? */
   423			}
   424		}
   425		dma_async_issue_pending(mcspi_dma->dma_tx);
                                        ^^^^^^^^^^^^^^^^^
Dereferenced inside the function call.  Probably it should be moved
inside the if condition.

   426		omap2_mcspi_set_dma_req(spi, 0, 1);
   427	

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2014-04-11 11:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11 11:20 Dan Carpenter [this message]
2014-04-11 11:29 ` spi: omap2-mcspi: Cleanup the omap2_mcspi_txrx_dma function Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2013-11-01 10:32 Dan Carpenter

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=20140411112021.GA9166@mwanda \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=shubhrajyoti-l0cyMroinI0@public.gmane.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.