linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: re: spi: imx: initialize usedma earlier
Date: Wed, 16 Mar 2016 10:42:38 +0300	[thread overview]
Message-ID: <20160316074238.GD12860@mwanda> (raw)

Hello Sascha Hauer,

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

The patch c008a8007162: "spi: imx: initialize usedma earlier" from
Feb 24, 2016, leads to the following Smatch complaint:

drivers/spi/spi-imx.c:870 spi_imx_setupxfer()
	 error: we previously assumed 't' could be null (see line 848)

drivers/spi/spi-imx.c
   847	
   848		config.bpw = t ? t->bits_per_word : spi->bits_per_word;
                             ^
   849		config.speed_hz  = t ? t->speed_hz : spi->max_speed_hz;
                                   ^
Old code checks for NULL.

   850		config.mode = spi->mode;
   851		config.cs = spi->chip_select;
   852	
   853		if (!config.speed_hz)
   854			config.speed_hz = spi->max_speed_hz;
   855		if (!config.bpw)
   856			config.bpw = spi->bits_per_word;
   857	
   858		/* Initialize the functions for transfer */
   859		if (config.bpw <= 8) {
   860			spi_imx->rx = spi_imx_buf_rx_u8;
   861			spi_imx->tx = spi_imx_buf_tx_u8;
   862		} else if (config.bpw <= 16) {
   863			spi_imx->rx = spi_imx_buf_rx_u16;
   864			spi_imx->tx = spi_imx_buf_tx_u16;
   865		} else {
   866			spi_imx->rx = spi_imx_buf_rx_u32;
   867			spi_imx->tx = spi_imx_buf_tx_u32;
   868		}
   869	
   870		if (spi_imx_can_dma(spi_imx->bitbang.master, spi, t))
                                                                  ^
Patch adds a new unchecked dereference (inside the function call).

   871			spi_imx->usedma = 1;
   872		else

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:[~2016-03-16  7:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16  7:42 Dan Carpenter [this message]
2016-03-17  8:25 ` spi: imx: initialize usedma earlier Sascha Hauer

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=20160316074238.GD12860@mwanda \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).