lkml.org 
[lkml]   [2021]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v12 15/17] counter: Implement events_queue_size sysfs attribute
Hi William,

url: https://github.com/0day-ci/linux/commits/William-Breathitt-Gray/Introduce-the-Counter-character-device-interface/20210705-162324
base: 6cbb3aa0f9d5d23221df787cf36f74d3866fdb78
config: parisc-randconfig-m031-20210705 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/counter/counter-sysfs.c:815 counter_events_queue_size_write() warn: inconsistent returns '&counter->chrdev_lock'.

vim +815 drivers/counter/counter-sysfs.c

d95f8a2e83a813 William Breathitt Gray 2021-07-05 794 static int counter_events_queue_size_write(struct counter_device *counter,
d95f8a2e83a813 William Breathitt Gray 2021-07-05 795 u64 val)
d95f8a2e83a813 William Breathitt Gray 2021-07-05 796 {
d95f8a2e83a813 William Breathitt Gray 2021-07-05 797 int err;
d95f8a2e83a813 William Breathitt Gray 2021-07-05 798 DECLARE_KFIFO_PTR(events, struct counter_event);
d95f8a2e83a813 William Breathitt Gray 2021-07-05 799
d95f8a2e83a813 William Breathitt Gray 2021-07-05 800 /* Verify chrdev is not currently being used */
d95f8a2e83a813 William Breathitt Gray 2021-07-05 801 if (!mutex_trylock(&counter->chrdev_lock))
d95f8a2e83a813 William Breathitt Gray 2021-07-05 802 return -EBUSY;
d95f8a2e83a813 William Breathitt Gray 2021-07-05 803
d95f8a2e83a813 William Breathitt Gray 2021-07-05 804 /* Allocate new events queue */
d95f8a2e83a813 William Breathitt Gray 2021-07-05 805 err = kfifo_alloc(&events, val, GFP_ATOMIC);
d95f8a2e83a813 William Breathitt Gray 2021-07-05 806 if (err)
d95f8a2e83a813 William Breathitt Gray 2021-07-05 807 return err;

Drop the lock. With a mutex the alloc() doesn't necessarily have to
ATOMIC by the way.

d95f8a2e83a813 William Breathitt Gray 2021-07-05 808
d95f8a2e83a813 William Breathitt Gray 2021-07-05 809 /* Swap in new events queue */
d95f8a2e83a813 William Breathitt Gray 2021-07-05 810 kfifo_free(&counter->events);
d95f8a2e83a813 William Breathitt Gray 2021-07-05 811 counter->events.kfifo = events.kfifo;
d95f8a2e83a813 William Breathitt Gray 2021-07-05 812
d95f8a2e83a813 William Breathitt Gray 2021-07-05 813 mutex_unlock(&counter->chrdev_lock);
d95f8a2e83a813 William Breathitt Gray 2021-07-05 814
d95f8a2e83a813 William Breathitt Gray 2021-07-05 @815 return 0;
d95f8a2e83a813 William Breathitt Gray 2021-07-05 816 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

\
 
 \ /
  Last update: 2021-07-06 09:51    [W:0.397 / U:1.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site