1. 21 12月, 2021 10 次提交
  2. 17 12月, 2021 10 次提交
  3. 16 12月, 2021 6 次提交
    • K
      iio: stmpe-adc: Use correctly sized arguments for bit field · 3511989c
      Kees Cook 提交于
      The find.h APIs are designed to be used only on unsigned long arguments.
      This can technically result in a over-read, but it is harmless in this
      case. Regardless, fix it to avoid the warning seen under -Warray-bounds,
      which we'd like to enable globally:
      
      In file included from ./include/linux/bitmap.h:9,
                       from ./include/linux/cpumask.h:12,
                       from ./arch/x86/include/asm/cpumask.h:5,
                       from ./arch/x86/include/asm/msr.h:11,
                       from ./arch/x86/include/asm/processor.h:22,
                       from ./arch/x86/include/asm/cpufeature.h:5,
                       from ./arch/x86/include/asm/thread_info.h:53,
                       from ./include/linux/thread_info.h:60,
                       from ./arch/x86/include/asm/preempt.h:7,
                       from ./include/linux/preempt.h:78,
                       from ./include/linux/spinlock.h:55,
                       from ./include/linux/swait.h:7,
                       from ./include/linux/completion.h:12,
                       from drivers/iio/adc/stmpe-adc.c:10:
      drivers/iio/adc/stmpe-adc.c: In function 'stmpe_adc_probe':
      ./include/linux/find.h:98:23: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'u32[1]' {aka 'unsigned int[1]'} [-Warray-bounds]
         98 |                 val = *addr | ~GENMASK(size - 1, offset);
            |                       ^~~~~
      drivers/iio/adc/stmpe-adc.c:258:13: note: while referencing 'norequest_mask'
        258 |         u32 norequest_mask = 0;
            |             ^~~~~~~~~~~~~~
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
      3511989c
    • M
      iio:adc:ti-ads8688:: remove redundant ret variable · 8a457852
      Minghao Chi 提交于
      Return value from ads8688_prog_write() directly instead
      of taking this in another redundant variable.
      Reported-by: NZeal Robot <zealci@zte.com.cn>
      Signed-off-by: NMinghao Chi <chi.minghao@zte.com.cn>
      Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
      8a457852
    • D
      iio: addac: ad74413r: fix off by one in ad74413r_parse_channel_config() · 5d97d9e9
      Dan Carpenter 提交于
      The > needs to be >= to prevent accessing one element beyond the end of
      the st->channel_configs[] array.
      
      Fixes: fea251b6 ("iio: addac: add AD74413R driver")
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: NCosmin Tanislav <cosmin.tanislav@analog.com>
      Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
      5d97d9e9
    • X
      iio: adc: ad7606: Fix syntax errors in comments · 0a52c3f3
      Xiang wangx 提交于
      Delete the redundant word 'the'.
      Signed-off-by: NXiang wangx <wangxiang@cdjrlc.com>
      Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
      0a52c3f3
    • Z
      iio: event_monitor: Flush output on event · c054fe99
      Zach DeCook 提交于
      By flushing the output, iio_event_monitor can be more useful to programs
      chained along with it.
      
        iio_event_monitor stk3310 | awk '/rising/{system("my_unlockscreen.sh")} /falling/{system("my_lockscreen.sh")}'
      
      Without this flush, the above example would buffer a number of events,
      then after a while run the lock/unlock scripts several times.
      Signed-off-by: NZach DeCook <zachdecook@librem.one>
      Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
      c054fe99
    • L
      iio: iio_device_alloc(): Remove unnecessary self drvdata · 8b7651f2
      Lars-Peter Clausen 提交于
      Drvdata is typically used by drivers to attach driver specific data to a
      device. It is used to retrieve driver specific information when only the
      device to which the data is attached is available.
      
      In the IIO core in the `iio_device_alloc()` function we call
      `iio_device_set_drvdata(indio_dev, indio_dev)`. This sets the drvdata of
      the IIO device to itself.
      
      This is rather unnecessary since if we have a pointer to the IIO device to
      call `iio_device_get_drvdata()` on it we don't need to call the function
      since we already have the pointer. If we only have a pointer to the `struct
      device` we can use `dev_to_iio_dev()` to get the IIO device from it.
      
      Furthermore the drvdata is supposed to be reserved for drivers, so it
      should not be used by the IIO core in the first place.
      
      The `set_drvdata()` has been around from the very beginning of the IIO
      framework and back then it was used in the IIO device sysfs attribute
      handling code. But that was subsequently replaced with a `dev_to_iio_dev()`
      in commit e53f5ac5 ("iio: Use dev_to_iio_dev()") and other cleanups.
      
      The self `set_drvdata()` is now no longer needed and can be removed.
      
      Verified that there no longer any users by checking for potential users
      using the following two coccinelle scripts and reviewing that none of the
      matches are problematic code.
      
      <smpl>
      @@
      struct iio_dev *iio_dev;
      expression dev;
      identifier fn !~ "(remove|resume|suspend)";
      @@
      fn(...)
      {
      ...
      *iio_dev = dev_get_drvdata(dev)
      ...
      }
      </smpl>
      
      <smpl>
      @r1@
      position p;
      struct iio_dev *indio_dev;
      identifier dev_fn =~ "^dev_";
      identifier devm_fn =~ "^devm_";
      @@
      (
       dev_fn
      |
       devm_fn
      )
       (&indio_dev@p->dev, ...)
      
      @@
      struct iio_dev *indio_dev;
      position p != r1.p;
      @@
      *&indio_dev@p->dev</smpl>
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
      8b7651f2
  4. 13 12月, 2021 14 次提交