* [jic23-iio:testing 23/47] drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
@ 2025-02-03 23:23 kernel test robot
2025-02-04 8:43 ` Angelo Dureghello
0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2025-02-03 23:23 UTC (permalink / raw)
To: Angelo Dureghello; +Cc: oe-kbuild-all, Jonathan Cameron, Nuno Sa
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head: 315198c0a370da031f5c3d504b99f771a0c545ab
commit: 493122c53af1915b4b5b5f47a8c446973ebff052 [23/47] iio: dac: adi-axi-dac: add bus mode setup
config: m68k-randconfig-r071-20250204 (https://download.01.org/0day-ci/archive/20250204/202502040758.DJqHqhLO-lkp@intel.com/config)
compiler: m68k-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502040758.DJqHqhLO-lkp@intel.com/
smatch warnings:
drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
vim +731 drivers/iio/dac/adi-axi-dac.c
724
725 static int axi_dac_bus_set_io_mode(struct iio_backend *back,
726 enum ad3552r_io_mode mode)
727 {
728 struct axi_dac_state *st = iio_backend_get_priv(back);
729 int ival, ret;
730
> 731 if (!(mode >= AD3552R_IO_MODE_SPI && mode <= AD3552R_IO_MODE_QSPI))
732 return -EINVAL;
733
734 guard(mutex)(&st->lock);
735
736 ret = regmap_update_bits(st->regmap, AXI_DAC_CUSTOM_CTRL_REG,
737 AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE,
738 FIELD_PREP(AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE, mode));
739 if (ret)
740 return ret;
741
742 return regmap_read_poll_timeout(st->regmap, AXI_DAC_UI_STATUS_REG, ival,
743 FIELD_GET(AXI_DAC_UI_STATUS_IF_BUSY, ival) == 0, 10,
744 100 * KILO);
745 }
746
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [jic23-iio:testing 23/47] drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
2025-02-03 23:23 [jic23-iio:testing 23/47] drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)' kernel test robot
@ 2025-02-04 8:43 ` Angelo Dureghello
2025-02-04 8:57 ` Jonathan Cameron
0 siblings, 1 reply; 6+ messages in thread
From: Angelo Dureghello @ 2025-02-04 8:43 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: oe-kbuild-all, Jonathan Cameron, Nuno Sa
Hi Jonathan,
On 04.02.2025 07:23, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
> head: 315198c0a370da031f5c3d504b99f771a0c545ab
> commit: 493122c53af1915b4b5b5f47a8c446973ebff052 [23/47] iio: dac: adi-axi-dac: add bus mode setup
> config: m68k-randconfig-r071-20250204 (https://download.01.org/0day-ci/archive/20250204/202502040758.DJqHqhLO-lkp@intel.com/config)
> compiler: m68k-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@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202502040758.DJqHqhLO-lkp@intel.com/
>
> smatch warnings:
> drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
>
> vim +731 drivers/iio/dac/adi-axi-dac.c
>
> 724
> 725 static int axi_dac_bus_set_io_mode(struct iio_backend *back,
> 726 enum ad3552r_io_mode mode)
> 727 {
> 728 struct axi_dac_state *st = iio_backend_get_priv(back);
> 729 int ival, ret;
> 730
> > 731 if (!(mode >= AD3552R_IO_MODE_SPI && mode <= AD3552R_IO_MODE_QSPI))
> 732
not clear to me the reason of this warning, maybe because mode is an enum ?
Should i take any action ?
return -EINVAL;
> 733
> 734 guard(mutex)(&st->lock);
> 735
> 736 ret = regmap_update_bits(st->regmap, AXI_DAC_CUSTOM_CTRL_REG,
> 737 AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE,
> 738 FIELD_PREP(AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE, mode));
> 739 if (ret)
> 740 return ret;
> 741
> 742 return regmap_read_poll_timeout(st->regmap, AXI_DAC_UI_STATUS_REG, ival,
> 743 FIELD_GET(AXI_DAC_UI_STATUS_IF_BUSY, ival) == 0, 10,
> 744 100 * KILO);
> 745 }
> 746
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
Thanks,
regards,
angelo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [jic23-iio:testing 23/47] drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
2025-02-04 8:43 ` Angelo Dureghello
@ 2025-02-04 8:57 ` Jonathan Cameron
2025-02-04 9:12 ` Angelo Dureghello
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2025-02-04 8:57 UTC (permalink / raw)
To: Angelo Dureghello; +Cc: oe-kbuild-all, Nuno Sa, linux-iio
On Tue, 4 Feb 2025 09:43:17 +0100
Angelo Dureghello <adureghello@baylibre.com> wrote:
> Hi Jonathan,
>
> On 04.02.2025 07:23, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
> > head: 315198c0a370da031f5c3d504b99f771a0c545ab
> > commit: 493122c53af1915b4b5b5f47a8c446973ebff052 [23/47] iio: dac: adi-axi-dac: add bus mode setup
> > config: m68k-randconfig-r071-20250204 (https://download.01.org/0day-ci/archive/20250204/202502040758.DJqHqhLO-lkp@intel.com/config)
> > compiler: m68k-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@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202502040758.DJqHqhLO-lkp@intel.com/
> >
> > smatch warnings:
> > drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
> >
> > vim +731 drivers/iio/dac/adi-axi-dac.c
> >
> > 724
> > 725 static int axi_dac_bus_set_io_mode(struct iio_backend *back,
> > 726 enum ad3552r_io_mode mode)
> > 727 {
> > 728 struct axi_dac_state *st = iio_backend_get_priv(back);
> > 729 int ival, ret;
> > 730
> > > 731 if (!(mode >= AD3552R_IO_MODE_SPI && mode <= AD3552R_IO_MODE_QSPI))
> > 732
>
> not clear to me the reason of this warning, maybe because mode is an enum ?
> Should i take any action ?
Currently there are only a few modes in there and that range covers them all I think.
So warning is correct, but we perhaps want this check there as hardening against future
addition of more modes. Maybe an explicit switch with all modes listed and a default
will have same effect and be better defense anyway against future changes?
Jonathan
>
> return -EINVAL;
> > 733
> > 734 guard(mutex)(&st->lock);
> > 735
> > 736 ret = regmap_update_bits(st->regmap, AXI_DAC_CUSTOM_CTRL_REG,
> > 737 AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE,
> > 738 FIELD_PREP(AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE, mode));
> > 739 if (ret)
> > 740 return ret;
> > 741
> > 742 return regmap_read_poll_timeout(st->regmap, AXI_DAC_UI_STATUS_REG, ival,
> > 743 FIELD_GET(AXI_DAC_UI_STATUS_IF_BUSY, ival) == 0, 10,
> > 744 100 * KILO);
> > 745 }
> > 746
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
>
> Thanks,
> regards,
> angelo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [jic23-iio:testing 23/47] drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
2025-02-04 8:57 ` Jonathan Cameron
@ 2025-02-04 9:12 ` Angelo Dureghello
2025-02-04 19:27 ` Jonathan Cameron
0 siblings, 1 reply; 6+ messages in thread
From: Angelo Dureghello @ 2025-02-04 9:12 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: oe-kbuild-all, Nuno Sa, linux-iio
On 04.02.2025 08:57, Jonathan Cameron wrote:
> On Tue, 4 Feb 2025 09:43:17 +0100
> Angelo Dureghello <adureghello@baylibre.com> wrote:
>
> > Hi Jonathan,
> >
> > On 04.02.2025 07:23, kernel test robot wrote:
> > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
> > > head: 315198c0a370da031f5c3d504b99f771a0c545ab
> > > commit: 493122c53af1915b4b5b5f47a8c446973ebff052 [23/47] iio: dac: adi-axi-dac: add bus mode setup
> > > config: m68k-randconfig-r071-20250204 (https://download.01.org/0day-ci/archive/20250204/202502040758.DJqHqhLO-lkp@intel.com/config)
> > > compiler: m68k-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@intel.com>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202502040758.DJqHqhLO-lkp@intel.com/
> > >
> > > smatch warnings:
> > > drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
> > >
> > > vim +731 drivers/iio/dac/adi-axi-dac.c
> > >
> > > 724
> > > 725 static int axi_dac_bus_set_io_mode(struct iio_backend *back,
> > > 726 enum ad3552r_io_mode mode)
> > > 727 {
> > > 728 struct axi_dac_state *st = iio_backend_get_priv(back);
> > > 729 int ival, ret;
> > > 730
> > > > 731 if (!(mode >= AD3552R_IO_MODE_SPI && mode <= AD3552R_IO_MODE_QSPI))
> > > 732
> >
> > not clear to me the reason of this warning, maybe because mode is an enum ?
> > Should i take any action ?
>
> Currently there are only a few modes in there and that range covers them all I think.
> So warning is correct, but we perhaps want this check there as hardening against future
> addition of more modes. Maybe an explicit switch with all modes listed and a default
> will have same effect and be better defense anyway against future changes?
>
> Jonathan
thanks, clear now.
Is maintaining the waring an issue ?
Another chance may be adding a AD3552R_IO_MODE_MAX as last item ?
angelo
>
>
> >
> > return -EINVAL;
> > > 733
> > > 734 guard(mutex)(&st->lock);
> > > 735
> > > 736 ret = regmap_update_bits(st->regmap, AXI_DAC_CUSTOM_CTRL_REG,
> > > 737 AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE,
> > > 738 FIELD_PREP(AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE, mode));
> > > 739 if (ret)
> > > 740 return ret;
> > > 741
> > > 742 return regmap_read_poll_timeout(st->regmap, AXI_DAC_UI_STATUS_REG, ival,
> > > 743 FIELD_GET(AXI_DAC_UI_STATUS_IF_BUSY, ival) == 0, 10,
> > > 744 100 * KILO);
> > > 745 }
> > > 746
> > >
> > > --
> > > 0-DAY CI Kernel Test Service
> > > https://github.com/intel/lkp-tests/wiki
> >
> > Thanks,
> > regards,
> > angelo
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [jic23-iio:testing 23/47] drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
2025-02-04 9:12 ` Angelo Dureghello
@ 2025-02-04 19:27 ` Jonathan Cameron
2025-02-08 15:10 ` Jonathan Cameron
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2025-02-04 19:27 UTC (permalink / raw)
To: Angelo Dureghello; +Cc: Jonathan Cameron, oe-kbuild-all, Nuno Sa, linux-iio
On Tue, 4 Feb 2025 10:12:05 +0100
Angelo Dureghello <adureghello@baylibre.com> wrote:
> On 04.02.2025 08:57, Jonathan Cameron wrote:
> > On Tue, 4 Feb 2025 09:43:17 +0100
> > Angelo Dureghello <adureghello@baylibre.com> wrote:
> >
> > > Hi Jonathan,
> > >
> > > On 04.02.2025 07:23, kernel test robot wrote:
> > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
> > > > head: 315198c0a370da031f5c3d504b99f771a0c545ab
> > > > commit: 493122c53af1915b4b5b5f47a8c446973ebff052 [23/47] iio: dac: adi-axi-dac: add bus mode setup
> > > > config: m68k-randconfig-r071-20250204 (https://download.01.org/0day-ci/archive/20250204/202502040758.DJqHqhLO-lkp@intel.com/config)
> > > > compiler: m68k-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@intel.com>
> > > > | Closes: https://lore.kernel.org/oe-kbuild-all/202502040758.DJqHqhLO-lkp@intel.com/
> > > >
> > > > smatch warnings:
> > > > drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
> > > >
> > > > vim +731 drivers/iio/dac/adi-axi-dac.c
> > > >
> > > > 724
> > > > 725 static int axi_dac_bus_set_io_mode(struct iio_backend *back,
> > > > 726 enum ad3552r_io_mode mode)
> > > > 727 {
> > > > 728 struct axi_dac_state *st = iio_backend_get_priv(back);
> > > > 729 int ival, ret;
> > > > 730
> > > > > 731 if (!(mode >= AD3552R_IO_MODE_SPI && mode <= AD3552R_IO_MODE_QSPI))
> > > > 732
> > >
> > > not clear to me the reason of this warning, maybe because mode is an enum ?
> > > Should i take any action ?
> >
> > Currently there are only a few modes in there and that range covers them all I think.
> > So warning is correct, but we perhaps want this check there as hardening against future
> > addition of more modes. Maybe an explicit switch with all modes listed and a default
> > will have same effect and be better defense anyway against future changes?
> >
> > Jonathan
>
> thanks, clear now.
> Is maintaining the waring an issue ?
> Another chance may be adding a AD3552R_IO_MODE_MAX as last item ?
Hmm. If these are the only plausible modes for enum ad3552r_io_mode
ever to have, we could just drop the check.
>
> angelo
> >
> >
> > >
> > > return -EINVAL;
> > > > 733
> > > > 734 guard(mutex)(&st->lock);
> > > > 735
> > > > 736 ret = regmap_update_bits(st->regmap, AXI_DAC_CUSTOM_CTRL_REG,
> > > > 737 AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE,
> > > > 738 FIELD_PREP(AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE, mode));
> > > > 739 if (ret)
> > > > 740 return ret;
> > > > 741
> > > > 742 return regmap_read_poll_timeout(st->regmap, AXI_DAC_UI_STATUS_REG, ival,
> > > > 743 FIELD_GET(AXI_DAC_UI_STATUS_IF_BUSY, ival) == 0, 10,
> > > > 744 100 * KILO);
> > > > 745 }
> > > > 746
> > > >
> > > > --
> > > > 0-DAY CI Kernel Test Service
> > > > https://github.com/intel/lkp-tests/wiki
> > >
> > > Thanks,
> > > regards,
> > > angelo
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [jic23-iio:testing 23/47] drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
2025-02-04 19:27 ` Jonathan Cameron
@ 2025-02-08 15:10 ` Jonathan Cameron
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2025-02-08 15:10 UTC (permalink / raw)
To: Angelo Dureghello; +Cc: Jonathan Cameron, oe-kbuild-all, Nuno Sa, linux-iio
On Tue, 4 Feb 2025 19:27:55 +0000
Jonathan Cameron <jic23@kernel.org> wrote:
> On Tue, 4 Feb 2025 10:12:05 +0100
> Angelo Dureghello <adureghello@baylibre.com> wrote:
>
> > On 04.02.2025 08:57, Jonathan Cameron wrote:
> > > On Tue, 4 Feb 2025 09:43:17 +0100
> > > Angelo Dureghello <adureghello@baylibre.com> wrote:
> > >
> > > > Hi Jonathan,
> > > >
> > > > On 04.02.2025 07:23, kernel test robot wrote:
> > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
> > > > > head: 315198c0a370da031f5c3d504b99f771a0c545ab
> > > > > commit: 493122c53af1915b4b5b5f47a8c446973ebff052 [23/47] iio: dac: adi-axi-dac: add bus mode setup
> > > > > config: m68k-randconfig-r071-20250204 (https://download.01.org/0day-ci/archive/20250204/202502040758.DJqHqhLO-lkp@intel.com/config)
> > > > > compiler: m68k-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@intel.com>
> > > > > | Closes: https://lore.kernel.org/oe-kbuild-all/202502040758.DJqHqhLO-lkp@intel.com/
> > > > >
> > > > > smatch warnings:
> > > > > drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)'
> > > > >
> > > > > vim +731 drivers/iio/dac/adi-axi-dac.c
> > > > >
> > > > > 724
> > > > > 725 static int axi_dac_bus_set_io_mode(struct iio_backend *back,
> > > > > 726 enum ad3552r_io_mode mode)
> > > > > 727 {
> > > > > 728 struct axi_dac_state *st = iio_backend_get_priv(back);
> > > > > 729 int ival, ret;
> > > > > 730
> > > > > > 731 if (!(mode >= AD3552R_IO_MODE_SPI && mode <= AD3552R_IO_MODE_QSPI))
> > > > > 732
> > > >
> > > > not clear to me the reason of this warning, maybe because mode is an enum ?
> > > > Should i take any action ?
> > >
> > > Currently there are only a few modes in there and that range covers them all I think.
> > > So warning is correct, but we perhaps want this check there as hardening against future
> > > addition of more modes. Maybe an explicit switch with all modes listed and a default
> > > will have same effect and be better defense anyway against future changes?
> > >
> > > Jonathan
> >
> > thanks, clear now.
> > Is maintaining the waring an issue ?
> > Another chance may be adding a AD3552R_IO_MODE_MAX as last item ?
>
> Hmm. If these are the only plausible modes for enum ad3552r_io_mode
> ever to have, we could just drop the check.
I've dropped the check.
Thanks,
Jonathan
>
> >
> > angelo
> > >
> > >
> > > >
> > > > return -EINVAL;
> > > > > 733
> > > > > 734 guard(mutex)(&st->lock);
> > > > > 735
> > > > > 736 ret = regmap_update_bits(st->regmap, AXI_DAC_CUSTOM_CTRL_REG,
> > > > > 737 AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE,
> > > > > 738 FIELD_PREP(AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE, mode));
> > > > > 739 if (ret)
> > > > > 740 return ret;
> > > > > 741
> > > > > 742 return regmap_read_poll_timeout(st->regmap, AXI_DAC_UI_STATUS_REG, ival,
> > > > > 743 FIELD_GET(AXI_DAC_UI_STATUS_IF_BUSY, ival) == 0, 10,
> > > > > 744 100 * KILO);
> > > > > 745 }
> > > > > 746
> > > > >
> > > > > --
> > > > > 0-DAY CI Kernel Test Service
> > > > > https://github.com/intel/lkp-tests/wiki
> > > >
> > > > Thanks,
> > > > regards,
> > > > angelo
> > >
> >
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-08 15:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 23:23 [jic23-iio:testing 23/47] drivers/iio/dac/adi-axi-dac.c:731 axi_dac_bus_set_io_mode() warn: always true condition '(mode >= 0) => (0-u32max >= 0)' kernel test robot
2025-02-04 8:43 ` Angelo Dureghello
2025-02-04 8:57 ` Jonathan Cameron
2025-02-04 9:12 ` Angelo Dureghello
2025-02-04 19:27 ` Jonathan Cameron
2025-02-08 15:10 ` Jonathan Cameron
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.