Re: [PATCH v5 10/10] iio: accel: adxl345: add FIFO with watermark events

From: Jonathan Cameron
Date: Wed Dec 11 2024 - 14:20:20 EST


On Tue, 10 Dec 2024 11:47:37 +0300
Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:

> Hi Lothar,
>
> kernel test robot noticed the following build warnings:

Ah. This was the report you were referring to I guess. Just fix these in v6 version
of this patch.

Thanks,

Jonathan

>
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Lothar-Rubusch/iio-accel-adxl345-refrase-comment-on-probe/20241206-011802
> base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
> patch link: https://lore.kernel.org/r/20241205171343.308963-11-l.rubusch%40gmail.com
> patch subject: [PATCH v5 10/10] iio: accel: adxl345: add FIFO with watermark events
> config: nios2-randconfig-r072-20241210 (https://download.01.org/0day-ci/archive/20241210/202412101132.Kj6R6i3h-lkp@xxxxxxxxx/config)
> compiler: nios2-linux-gcc (GCC) 14.2.0
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> | Closes: https://lore.kernel.org/r/202412101132.Kj6R6i3h-lkp@xxxxxxxxx/
>
> smatch warnings:
> drivers/iio/accel/adxl345_core.c:441 adxl345_event_handler() warn: unsigned 'int_stat' is never less than zero.
>
> vim +/ret +321 drivers/iio/accel/adxl345_core.c
>
> 55d2386488598bb Lothar Rubusch 2024-12-05 433 static irqreturn_t adxl345_event_handler(int irq, void *p)
> 55d2386488598bb Lothar Rubusch 2024-12-05 434 {
> 55d2386488598bb Lothar Rubusch 2024-12-05 435 struct iio_dev *indio_dev = p;
> 55d2386488598bb Lothar Rubusch 2024-12-05 436 struct adxl345_state *st = iio_priv(indio_dev);
> 55d2386488598bb Lothar Rubusch 2024-12-05 437 u8 int_stat;
> ^^^^^^^^^^^
>
> 55d2386488598bb Lothar Rubusch 2024-12-05 438 int samples;
> 55d2386488598bb Lothar Rubusch 2024-12-05 439
> 55d2386488598bb Lothar Rubusch 2024-12-05 440 int_stat = adxl345_get_status(st);
> 55d2386488598bb Lothar Rubusch 2024-12-05 @441 if (int_stat < 0)
> ^^^^^^^^^^^^
> signedness bug
>
> 55d2386488598bb Lothar Rubusch 2024-12-05 442 return IRQ_NONE;
> 55d2386488598bb Lothar Rubusch 2024-12-05 443
> 55d2386488598bb Lothar Rubusch 2024-12-05 444 if (int_stat == 0x0)
> 55d2386488598bb Lothar Rubusch 2024-12-05 445 goto err;
> 55d2386488598bb Lothar Rubusch 2024-12-05 446
> 55d2386488598bb Lothar Rubusch 2024-12-05 447 if (int_stat & ADXL345_INT_OVERRUN)
> 55d2386488598bb Lothar Rubusch 2024-12-05 448 goto err;
> 55d2386488598bb Lothar Rubusch 2024-12-05 449
> 55d2386488598bb Lothar Rubusch 2024-12-05 450 if (int_stat & (ADXL345_INT_DATA_READY | ADXL345_INT_WATERMARK)) {
> 55d2386488598bb Lothar Rubusch 2024-12-05 451 samples = adxl345_get_samples(st);
> 55d2386488598bb Lothar Rubusch 2024-12-05 452 if (samples < 0)
> 55d2386488598bb Lothar Rubusch 2024-12-05 453 goto err;
> 55d2386488598bb Lothar Rubusch 2024-12-05 454
> 55d2386488598bb Lothar Rubusch 2024-12-05 455 if (adxl345_fifo_push(indio_dev, samples) < 0)
> 55d2386488598bb Lothar Rubusch 2024-12-05 456 goto err;
> 55d2386488598bb Lothar Rubusch 2024-12-05 457
> 55d2386488598bb Lothar Rubusch 2024-12-05 458 }
> 55d2386488598bb Lothar Rubusch 2024-12-05 459 return IRQ_HANDLED;
> 55d2386488598bb Lothar Rubusch 2024-12-05 460
> 55d2386488598bb Lothar Rubusch 2024-12-05 461 err:
> 55d2386488598bb Lothar Rubusch 2024-12-05 462 adxl345_fifo_reset(st);
> 55d2386488598bb Lothar Rubusch 2024-12-05 463
> 55d2386488598bb Lothar Rubusch 2024-12-05 464 return IRQ_HANDLED;
> 55d2386488598bb Lothar Rubusch 2024-12-05 465 }
>