Linux IIO development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: matt.ranostay@intel.com
Cc: linux-iio@vger.kernel.org
Subject: re: iio: imu: mpu6050: add mpu6500 register settings
Date: Wed, 2 Mar 2016 21:18:01 +0300	[thread overview]
Message-ID: <20160302181801.GA12744@mwanda> (raw)

Hello Matt Ranostay,

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

The patch 33da559f861b: "iio: imu: mpu6050: add mpu6500 register 
settings" from Feb 22, 2016, leads to the following Smatch complaint:

drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c:58 inv_mpu_probe()
	 error: we previously assumed 'id' could be null (see line 48)

drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
    47		const struct spi_device_id *id = spi_get_device_id(spi);
    48		const char *name = id ? id->name : NULL;
                                   ^^
Existing code assumed id could be NULL.

    49	
    50		regmap = devm_regmap_init_spi(spi, &inv_mpu_regmap_config);
    51		if (IS_ERR(regmap)) {
    52			dev_err(&spi->dev, "Failed to register spi regmap %d\n",
    53				(int)PTR_ERR(regmap));
    54			return PTR_ERR(regmap);
    55		}
    56	
    57		return inv_mpu_core_probe(regmap, spi->irq, name,
    58					  inv_mpu_i2c_disable, id->driver_data);
                                                               ^^^^^^^^^^^^^^^
The patch adds an unchecked dereference.

    59	}
    60	

regards,
dan carpenter

             reply	other threads:[~2016-03-02 18:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02 18:18 Dan Carpenter [this message]
2016-03-02 18:21 ` iio: imu: mpu6050: add mpu6500 register settings Dan Carpenter
2016-03-02 22:04   ` Matt Ranostay
2016-03-05 17:50     ` Jonathan Cameron
2016-03-07  8:19       ` Adriana Reus

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=20160302181801.GA12744@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=matt.ranostay@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox