mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 07:34:12 +08:00
gpiolib: cdev: use !mem_is_zero() instead of memchr_inv(s, 0, n)
Use the mem_is_zero() helper where possible. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20241110201706.16614-1-andy.shevchenko@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
10287f0f9e
commit
e106b1dd38
@ -16,7 +16,6 @@
|
||||
#include <linux/hte.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irqreturn.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kfifo.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
@ -25,6 +24,7 @@
|
||||
#include <linux/poll.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/timekeeping.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/workqueue.h>
|
||||
@ -1215,7 +1215,7 @@ static int gpio_v2_line_config_validate(struct gpio_v2_line_config *lc,
|
||||
if (lc->num_attrs > GPIO_V2_LINE_NUM_ATTRS_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
if (memchr_inv(lc->padding, 0, sizeof(lc->padding)))
|
||||
if (!mem_is_zero(lc->padding, sizeof(lc->padding)))
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < num_lines; i++) {
|
||||
@ -1629,7 +1629,7 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip)
|
||||
if ((ulr.num_lines == 0) || (ulr.num_lines > GPIO_V2_LINES_MAX))
|
||||
return -EINVAL;
|
||||
|
||||
if (memchr_inv(ulr.padding, 0, sizeof(ulr.padding)))
|
||||
if (!mem_is_zero(ulr.padding, sizeof(ulr.padding)))
|
||||
return -EINVAL;
|
||||
|
||||
lc = &ulr.config;
|
||||
@ -2411,7 +2411,7 @@ static int lineinfo_get(struct gpio_chardev_data *cdev, void __user *ip,
|
||||
if (copy_from_user(&lineinfo, ip, sizeof(lineinfo)))
|
||||
return -EFAULT;
|
||||
|
||||
if (memchr_inv(lineinfo.padding, 0, sizeof(lineinfo.padding)))
|
||||
if (!mem_is_zero(lineinfo.padding, sizeof(lineinfo.padding)))
|
||||
return -EINVAL;
|
||||
|
||||
desc = gpio_device_get_desc(cdev->gdev, lineinfo.offset);
|
||||
|
Loading…
Reference in New Issue
Block a user