drivers/acpi/x86/s2idle.c:138:25: warning: variable 'obj_new' set but not used
From: kernel test robot
Date: Sat Dec 26 2020 - 12:46:26 EST
Hi Rafael,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 40f78232f97344afbbeb5b0008615f17c4b93466
commit: fef98671194be005853cbbf51b164a3927589b64 ACPI: PM: s2idle: Move x86-specific code to the x86 directory
date: 9 days ago
config: i386-randconfig-r011-20201223 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fef98671194be005853cbbf51b164a3927589b64
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout fef98671194be005853cbbf51b164a3927589b64
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
drivers/acpi/x86/s2idle.c: In function 'lpi_device_get_constraints_amd':
>> drivers/acpi/x86/s2idle.c:138:25: warning: variable 'obj_new' set but not used [-Wunused-but-set-variable]
138 | union acpi_object *obj_new;
| ^~~~~~~
>> drivers/acpi/x86/s2idle.c:108:30: warning: variable 'info' set but not used [-Wunused-but-set-variable]
108 | struct lpi_device_info_amd info = { };
| ^~~~
vim +/obj_new +138 drivers/acpi/x86/s2idle.c
90
91 static void lpi_device_get_constraints_amd(void)
92 {
93 union acpi_object *out_obj;
94 int i, j, k;
95
96 out_obj = acpi_evaluate_dsm_typed(lps0_device_handle, &lps0_dsm_guid,
97 1, ACPI_LPS0_GET_DEVICE_CONSTRAINTS,
98 NULL, ACPI_TYPE_PACKAGE);
99
100 if (!out_obj)
101 return;
102
103 acpi_handle_debug(lps0_device_handle, "_DSM function 1 eval %s\n",
104 out_obj ? "successful" : "failed");
105
106 for (i = 0; i < out_obj->package.count; i++) {
107 union acpi_object *package = &out_obj->package.elements[i];
> 108 struct lpi_device_info_amd info = { };
109
110 if (package->type == ACPI_TYPE_INTEGER) {
111 switch (i) {
112 case 0:
113 info.revision = package->integer.value;
114 break;
115 case 1:
116 info.count = package->integer.value;
117 break;
118 }
119 } else if (package->type == ACPI_TYPE_PACKAGE) {
120 lpi_constraints_table = kcalloc(package->package.count,
121 sizeof(*lpi_constraints_table),
122 GFP_KERNEL);
123
124 if (!lpi_constraints_table)
125 goto free_acpi_buffer;
126
127 acpi_handle_debug(lps0_device_handle,
128 "LPI: constraints list begin:\n");
129
130 for (j = 0; j < package->package.count; ++j) {
131 union acpi_object *info_obj = &package->package.elements[j];
132 struct lpi_device_constraint_amd dev_info = {};
133 struct lpi_constraints *list;
134 acpi_status status;
135
136 for (k = 0; k < info_obj->package.count; ++k) {
137 union acpi_object *obj = &info_obj->package.elements[k];
> 138 union acpi_object *obj_new;
139
140 list = &lpi_constraints_table[lpi_constraints_table_size];
141 list->min_dstate = -1;
142
143 obj_new = &obj[k];
144 switch (k) {
145 case 0:
146 dev_info.enabled = obj->integer.value;
147 break;
148 case 1:
149 dev_info.name = obj->string.pointer;
150 break;
151 case 2:
152 dev_info.function_states = obj->integer.value;
153 break;
154 case 3:
155 dev_info.min_dstate = obj->integer.value;
156 break;
157 }
158
159 if (!dev_info.enabled || !dev_info.name ||
160 !dev_info.min_dstate)
161 continue;
162
163 status = acpi_get_handle(NULL, dev_info.name,
164 &list->handle);
165 if (ACPI_FAILURE(status))
166 continue;
167
168 acpi_handle_debug(lps0_device_handle,
169 "Name:%s\n", dev_info.name);
170
171 list->min_dstate = dev_info.min_dstate;
172
173 if (list->min_dstate < 0) {
174 acpi_handle_debug(lps0_device_handle,
175 "Incomplete constraint defined\n");
176 continue;
177 }
178 }
179 lpi_constraints_table_size++;
180 }
181 }
182 }
183
184 acpi_handle_debug(lps0_device_handle, "LPI: constraints list end\n");
185
186 free_acpi_buffer:
187 ACPI_FREE(out_obj);
188 }
189
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip