Re: [bug report] iio: adc: adding support for MCP3564 ADC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 14, 2023 at 01:01:02PM +0300, Dan Carpenter wrote:
> Hello Marius Cristea,
> 
> The patch 33ec3e5fc1ea: "iio: adc: adding support for MCP3564 ADC"
> from Aug 29, 2023 (linux-next), leads to the following Smatch static
> checker warning:
> 
> 	drivers/iio/adc/mcp3564.c:1426 mcp3564_probe()
> 	warn: address of NULL pointer 'indio_dev'
> 
> drivers/iio/adc/mcp3564.c
>     1418 static int mcp3564_probe(struct spi_device *spi)
>     1419 {
>     1420         int ret;
>     1421         struct iio_dev *indio_dev;
>     1422         struct mcp3564_state *adc;
>     1423 
>     1424         indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adc));
>     1425         if (!indio_dev) {
> --> 1426                 dev_err_probe(&indio_dev->dev, PTR_ERR(indio_dev),
>                                        ^^^^^^^^^^^^^^^
> This will crash

Actually I think that dev_err_probe() has a check for this kind of bug
so it doesn't actually crash.  The check is burried deep into the call
tree where it prints the name and if the address is < PAGE_SIZE it just
prints the device name as "(efault)".  But it's still not ideal.

regads,
dan carpenter




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux