[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202107060033.5eN2wc37-lkp@intel.com>
Date: Tue, 6 Jul 2021 10:48:31 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: kbuild@...ts.01.org,
William Breathitt Gray <vilhelm.gray@...il.com>,
jic23@...nel.org
Cc: lkp@...el.com, kbuild-all@...ts.01.org,
linux-stm32@...md-mailman.stormreply.com, kernel@...gutronix.de,
a.fatoum@...gutronix.de, kamel.bouhara@...tlin.com,
gwendal@...omium.org, alexandre.belloni@...tlin.com,
david@...hnology.com, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [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@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.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
Powered by blists - more mailing lists