Skip to content

Commit d0c94be

Browse files
cris-masudeep-holla
authored andcommitted
firmware: arm_scmi: Remove all the unused local variables
While using SCMI iterators helpers a few local automatic variables are defined but then used only as input for sizeof operators. cppcheck is fooled to complain about this with: | drivers/firmware/arm_scmi/sensors.c:341:48: warning: Variable 'msg' is | not assigned a value. [unassignedVariable] | struct scmi_msg_sensor_list_update_intervals *msg; Even though this is an innocuos warning, since the uninitialized variable is at the end never used in the reported cases, fix these occurences all over SCMI stack to avoid keeping unneeded objects on the stack. Link: https://lore.kernel.org/r/[email protected] Cc: Dan Carpenter <[email protected]> Cc: Sudeep Holla <[email protected]> Reported-by: kernel test robot <[email protected]> Signed-off-by: Cristian Marussi <[email protected]> Signed-off-by: Sudeep Holla <[email protected]>
1 parent 122839b commit d0c94be

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

drivers/firmware/arm_scmi/clock.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@ scmi_clock_describe_rates_get(const struct scmi_protocol_handle *ph, u32 clk_id,
266266
struct scmi_clock_info *clk)
267267
{
268268
int ret;
269-
270269
void *iter;
271-
struct scmi_msg_clock_describe_rates *msg;
272270
struct scmi_iterator_ops ops = {
273271
.prepare_message = iter_clk_describe_prepare_message,
274272
.update_state = iter_clk_describe_update_state,
@@ -281,7 +279,8 @@ scmi_clock_describe_rates_get(const struct scmi_protocol_handle *ph, u32 clk_id,
281279

282280
iter = ph->hops->iter_response_init(ph, &ops, SCMI_MAX_NUM_RATES,
283281
CLOCK_DESCRIBE_RATES,
284-
sizeof(*msg), &cpriv);
282+
sizeof(struct scmi_msg_clock_describe_rates),
283+
&cpriv);
285284
if (IS_ERR(iter))
286285
return PTR_ERR(iter);
287286

drivers/firmware/arm_scmi/perf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ scmi_perf_describe_levels_get(const struct scmi_protocol_handle *ph, u32 domain,
332332
{
333333
int ret;
334334
void *iter;
335-
struct scmi_msg_perf_describe_levels *msg;
336335
struct scmi_iterator_ops ops = {
337336
.prepare_message = iter_perf_levels_prepare_message,
338337
.update_state = iter_perf_levels_update_state,
@@ -345,7 +344,8 @@ scmi_perf_describe_levels_get(const struct scmi_protocol_handle *ph, u32 domain,
345344

346345
iter = ph->hops->iter_response_init(ph, &ops, MAX_OPPS,
347346
PERF_DESCRIBE_LEVELS,
348-
sizeof(*msg), &ppriv);
347+
sizeof(struct scmi_msg_perf_describe_levels),
348+
&ppriv);
349349
if (IS_ERR(iter))
350350
return PTR_ERR(iter);
351351

drivers/firmware/arm_scmi/sensors.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ static int scmi_sensor_update_intervals(const struct scmi_protocol_handle *ph,
338338
struct scmi_sensor_info *s)
339339
{
340340
void *iter;
341-
struct scmi_msg_sensor_list_update_intervals *msg;
342341
struct scmi_iterator_ops ops = {
343342
.prepare_message = iter_intervals_prepare_message,
344343
.update_state = iter_intervals_update_state,
@@ -351,7 +350,8 @@ static int scmi_sensor_update_intervals(const struct scmi_protocol_handle *ph,
351350

352351
iter = ph->hops->iter_response_init(ph, &ops, s->intervals.count,
353352
SENSOR_LIST_UPDATE_INTERVALS,
354-
sizeof(*msg), &upriv);
353+
sizeof(struct scmi_msg_sensor_list_update_intervals),
354+
&upriv);
355355
if (IS_ERR(iter))
356356
return PTR_ERR(iter);
357357

@@ -459,7 +459,6 @@ scmi_sensor_axis_extended_names_get(const struct scmi_protocol_handle *ph,
459459
struct scmi_sensor_info *s)
460460
{
461461
void *iter;
462-
struct scmi_msg_sensor_axis_description_get *msg;
463462
struct scmi_iterator_ops ops = {
464463
.prepare_message = iter_axes_desc_prepare_message,
465464
.update_state = iter_axes_extended_name_update_state,
@@ -468,7 +467,8 @@ scmi_sensor_axis_extended_names_get(const struct scmi_protocol_handle *ph,
468467

469468
iter = ph->hops->iter_response_init(ph, &ops, s->num_axis,
470469
SENSOR_AXIS_NAME_GET,
471-
sizeof(*msg), s);
470+
sizeof(struct scmi_msg_sensor_axis_description_get),
471+
s);
472472
if (IS_ERR(iter))
473473
return PTR_ERR(iter);
474474

@@ -481,7 +481,6 @@ static int scmi_sensor_axis_description(const struct scmi_protocol_handle *ph,
481481
{
482482
int ret;
483483
void *iter;
484-
struct scmi_msg_sensor_axis_description_get *msg;
485484
struct scmi_iterator_ops ops = {
486485
.prepare_message = iter_axes_desc_prepare_message,
487486
.update_state = iter_axes_desc_update_state,
@@ -495,7 +494,8 @@ static int scmi_sensor_axis_description(const struct scmi_protocol_handle *ph,
495494

496495
iter = ph->hops->iter_response_init(ph, &ops, s->num_axis,
497496
SENSOR_AXIS_DESCRIPTION_GET,
498-
sizeof(*msg), s);
497+
sizeof(struct scmi_msg_sensor_axis_description_get),
498+
s);
499499
if (IS_ERR(iter))
500500
return PTR_ERR(iter);
501501

drivers/firmware/arm_scmi/voltage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ static int scmi_voltage_levels_get(const struct scmi_protocol_handle *ph,
180180
{
181181
int ret;
182182
void *iter;
183-
struct scmi_msg_cmd_describe_levels *msg;
184183
struct scmi_iterator_ops ops = {
185184
.prepare_message = iter_volt_levels_prepare_message,
186185
.update_state = iter_volt_levels_update_state,
@@ -193,7 +192,8 @@ static int scmi_voltage_levels_get(const struct scmi_protocol_handle *ph,
193192

194193
iter = ph->hops->iter_response_init(ph, &ops, v->num_levels,
195194
VOLTAGE_DESCRIBE_LEVELS,
196-
sizeof(*msg), &vpriv);
195+
sizeof(struct scmi_msg_cmd_describe_levels),
196+
&vpriv);
197197
if (IS_ERR(iter))
198198
return PTR_ERR(iter);
199199

0 commit comments

Comments
 (0)