[PATCH 1/2] platform/x86: dell_rbu: Fix list usage

Stuart Hayes posted 2 patches 6 months, 3 weeks ago
There is a newer version of this series
[PATCH 1/2] platform/x86: dell_rbu: Fix list usage
Posted by Stuart Hayes 6 months, 3 weeks ago
Stop using an entire struct packet_data just for the embedded list_head,
and fix usage of that list_head.

Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
---
 drivers/platform/x86/dell/dell_rbu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/dell/dell_rbu.c b/drivers/platform/x86/dell/dell_rbu.c
index e30ca325938c..6a602a80160a 100644
--- a/drivers/platform/x86/dell/dell_rbu.c
+++ b/drivers/platform/x86/dell/dell_rbu.c
@@ -77,14 +77,14 @@ struct packet_data {
 	int ordernum;
 };
 
-static struct packet_data packet_data_head;
+struct list_head packet_data_list;
 
 static struct platform_device *rbu_device;
 static int context;
 
 static void init_packet_head(void)
 {
-	INIT_LIST_HEAD(&packet_data_head.list);
+	INIT_LIST_HEAD(&packet_data_list);
 	rbu_data.packet_read_count = 0;
 	rbu_data.num_packets = 0;
 	rbu_data.packetsize = 0;
@@ -183,7 +183,7 @@ static int create_packet(void *data, size_t length)
 
 	/* initialize the newly created packet headers */
 	INIT_LIST_HEAD(&newpacket->list);
-	list_add_tail(&newpacket->list, &packet_data_head.list);
+	list_add_tail(&newpacket->list, &packet_data_list);
 
 	memcpy(newpacket->data, data, length);
 
@@ -292,7 +292,7 @@ static int packet_read_list(char *data, size_t * pread_length)
 	remaining_bytes = *pread_length;
 	bytes_read = rbu_data.packet_read_count;
 
-	list_for_each_entry(newpacket, (&packet_data_head.list)->next, list) {
+	list_for_each_entry(newpacket, &packet_data_list, list) {
 		bytes_copied = do_packet_read(pdest, newpacket,
 			remaining_bytes, bytes_read, &temp_count);
 		remaining_bytes -= bytes_copied;
@@ -315,7 +315,7 @@ static void packet_empty_list(void)
 {
 	struct packet_data *newpacket, *tmp;
 
-	list_for_each_entry_safe(newpacket, tmp, (&packet_data_head.list)->next, list) {
+	list_for_each_entry_safe(newpacket, tmp, &packet_data_list, list) {
 		list_del(&newpacket->list);
 
 		/*
-- 
2.47.1
Re: [PATCH 1/2] platform/x86: dell_rbu: Fix list usage
Posted by kernel test robot 6 months, 3 weeks ago
Hi Stuart,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.15-rc7 next-20250522]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Stuart-Hayes/platform-x86-dell_rbu-Fix-list-usage/20250522-002119
base:   linus/master
patch link:    https://lore.kernel.org/r/20250521161639.47357-2-stuart.w.hayes%40gmail.com
patch subject: [PATCH 1/2] platform/x86: dell_rbu: Fix list usage
config: x86_64-randconfig-r113-20250522 (https://download.01.org/0day-ci/archive/20250522/202505222012.YMyWZkiR-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250522/202505222012.YMyWZkiR-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505222012.YMyWZkiR-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/platform/x86/dell/dell_rbu.c:80:18: sparse: sparse: symbol 'packet_data_list' was not declared. Should it be static?
   drivers/platform/x86/dell/dell_rbu.c:112:20: sparse: sparse: context imbalance in 'create_packet' - unexpected unlock

vim +/packet_data_list +80 drivers/platform/x86/dell/dell_rbu.c

    79	
  > 80	struct list_head packet_data_list;
    81	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki