summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-07-21 19:00:18 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2023-07-23 11:13:47 +0200
commitcb1d17535061ca295903f97f5cb0af9db719c02c (patch)
tree2b2287b958a30845ae849edd93f4d285cc6d375c /drivers/iio
parentiio: adc: meson: init voltage control bits (diff)
downloadlinux-cb1d17535061ca295903f97f5cb0af9db719c02c.tar.xz
linux-cb1d17535061ca295903f97f5cb0af9db719c02c.zip
iio: core: Use min() instead of min_t() to make code more robust
min() has strict type checking and preferred over min_t() for unsigned types to avoid overflow. Here it's unclear why min_t() was chosen since both variables are of the same type. In any case update to use min(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20230721170022.3461-5-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/industrialio-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index c117f50d0cf3..8fcf54fc0009 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -389,7 +389,7 @@ static ssize_t iio_debugfs_write_reg(struct file *file,
char buf[80];
int ret;
- count = min_t(size_t, count, (sizeof(buf)-1));
+ count = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, userbuf, count))
return -EFAULT;