All of lore.kernel.org
 help / color / mirror / Atom feed
* re: iio: imu: mpu6050: add mpu6500 register settings
@ 2016-03-02 18:18 Dan Carpenter
  2016-03-02 18:21 ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2016-03-02 18:18 UTC (permalink / raw)
  To: matt.ranostay; +Cc: linux-iio

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: iio: imu: mpu6050: add mpu6500 register settings
  2016-03-02 18:18 iio: imu: mpu6050: add mpu6500 register settings Dan Carpenter
@ 2016-03-02 18:21 ` Dan Carpenter
  2016-03-02 22:04   ` Matt Ranostay
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2016-03-02 18:21 UTC (permalink / raw)
  To: matt.ranostay; +Cc: linux-iio

I sent that too quickly.  The i2c version of inv_mpu_probe() has the
same issue as well.

	drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c:134 inv_mpu_probe()
	error: we previously assumed 'id' could be null (see line 119)

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: iio: imu: mpu6050: add mpu6500 register settings
  2016-03-02 18:21 ` Dan Carpenter
@ 2016-03-02 22:04   ` Matt Ranostay
  2016-03-05 17:50     ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Ranostay @ 2016-03-02 22:04 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: matt.ranostay, linux-iio

Will fix and submit this afternoon!

Sent from my iPhone

> On Mar 2, 2016, at 10:21, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> I sent that too quickly.  The i2c version of inv_mpu_probe() has the
> same issue as well.
> 
>    drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c:134 inv_mpu_probe()
>    error: we previously assumed 'id' could be null (see line 119)
> 
> regards,
> dan carpenter
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: iio: imu: mpu6050: add mpu6500 register settings
  2016-03-02 22:04   ` Matt Ranostay
@ 2016-03-05 17:50     ` Jonathan Cameron
  2016-03-07  8:19       ` Adriana Reus
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2016-03-05 17:50 UTC (permalink / raw)
  To: Matt Ranostay, Dan Carpenter; +Cc: matt.ranostay, linux-iio

On 02/03/16 22:04, Matt Ranostay wrote:
> Will fix and submit this afternoon!
> 
> Sent from my iPhone
> 
>> On Mar 2, 2016, at 10:21, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>>
>> I sent that too quickly.  The i2c version of inv_mpu_probe() has the
>> same issue as well.
>>
>>    drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c:134 inv_mpu_probe()
>>    error: we previously assumed 'id' could be null (see line 119)
>>
>> regards,
>> dan carpenter
Whilst true, I'm now wondering why we assumed it might be.  Paranoia perhaps?
Hmm, guess we should keep it consistent (he says having just bounced this
back to Matt)- I'll take it as is but as a cleanup rather than a fix.

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: iio: imu: mpu6050: add mpu6500 register settings
  2016-03-05 17:50     ` Jonathan Cameron
@ 2016-03-07  8:19       ` Adriana Reus
  0 siblings, 0 replies; 5+ messages in thread
From: Adriana Reus @ 2016-03-07  8:19 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Matt Ranostay, Dan Carpenter, matt.ranostay, linux-iio

My understanding from the previous commits is that it might be NULL
when enumerating via ACPI (I didn't dig into core to check this so I'm
not able to confirm if that is still the case).
(commit: 4f33fbae555000bf73aaacbc4f5b24668afc8c7a)

On Sat, Mar 5, 2016 at 7:50 PM, Jonathan Cameron <jic23@kernel.org> wrote:
> On 02/03/16 22:04, Matt Ranostay wrote:
>> Will fix and submit this afternoon!
>>
>> Sent from my iPhone
>>
>>> On Mar 2, 2016, at 10:21, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>>>
>>> I sent that too quickly.  The i2c version of inv_mpu_probe() has the
>>> same issue as well.
>>>
>>>    drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c:134 inv_mpu_probe()
>>>    error: we previously assumed 'id' could be null (see line 119)
>>>
>>> regards,
>>> dan carpenter
> Whilst true, I'm now wondering why we assumed it might be.  Paranoia perhaps?
> Hmm, guess we should keep it consistent (he says having just bounced this
> back to Matt)- I'll take it as is but as a cleanup rather than a fix.
>
> J
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-07  8:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-02 18:18 iio: imu: mpu6050: add mpu6500 register settings Dan Carpenter
2016-03-02 18:21 ` Dan Carpenter
2016-03-02 22:04   ` Matt Ranostay
2016-03-05 17:50     ` Jonathan Cameron
2016-03-07  8:19       ` Adriana Reus

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.