Skip to contentSkip to conversation

drivers/gpio/gpio-virtuser.c:400:24: warning: variable 'trimmed' set but not used

PATCH kernel test robot 2 participants 2 messages Jul 9, 2024 GPIO

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
head:   337049890b8cbbb4fb527c58976ea19f4dc747a0
commit: 91581c4b3f29e2e22aeb1a62e842d529ca638b2d [38/38] gpio: virtuser: new virtual testing driver for the GPIO API
config: microblaze-allmodconfig (https://download.01.org/0day-ci/archive/20240709/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240709/[email protected]/reproduce)

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/gpio/gpio-virtuser.c: In function 'gpio_virtuser_direction_do_write':

>> drivers/gpio/gpio-virtuser.c:400:24: warning: variable 'trimmed' set but not used [-Wunused-but-set-variable]
     400 |         char buf[32], *trimmed;
         |                        ^~~~~~~

vim +/trimmed +400 drivers/gpio/gpio-virtuser.c

392
393 static ssize_t gpio_virtuser_direction_do_write(struct file *file,
394 const char __user *user_buf,
395 size_t count, loff_t *ppos,
396 bool atomic)
397 {
398 struct gpio_virtuser_line_data *data = file->private_data;
399 struct gpio_desc *desc = data->ad.desc;

 > 400		char buf[32], *trimmed;

401 int ret, dir, val = 0;
402
403 ret = simple_write_to_buffer(buf, sizeof(buf), ppos, user_buf, count);
404 if (ret < 0)
405 return ret;
406
407 trimmed = strim(buf);
408
409 if (strcmp(buf, "input") == 0) {
410 dir = 1;
411 } else if (strcmp(buf, "output-high") == 0) {
412 dir = 0;
413 val = 1;
414 } else if (strcmp(buf, "output-low") == 0) {
415 dir = val = 0;
416 } else {
417 return -EINVAL;
418 }
419
420 if (!atomic)
421 ret = gpio_virtuser_set_direction(desc, dir, val);
422 else
423 ret = gpio_virtuser_set_direction_atomic(desc, dir, val);
424 if (ret)
425 return ret;
426
427 return count;
428 }
429

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 15 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
head:   337049890b8cbbb4fb527c58976ea19f4dc747a0
commit: 91581c4b3f29e2e22aeb1a62e842d529ca638b2d [38/38] gpio: virtuser: new virtual testing driver for the GPIO API
config: microblaze-allmodconfig (https://download.01.org/0day-ci/archive/20240709/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240709/[email protected]/reproduce)

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

Quoted 8 lines

drivers/gpio/gpio-virtuser.c: In function 'gpio_virtuser_direction_do_write':

Quoted 1 line
Quoted 1 line

drivers/gpio/gpio-virtuser.c:400:24: warning: variable 'trimmed' set but not used [-Wunused-but-set-variable]

     400 |         char buf[32], *trimmed;
         |                        ^~~~~~~

vim +/trimmed +400 drivers/gpio/gpio-virtuser.c

Fix sent out.

Bart