firmware: arm_scmi: Remove set but not used variable 'val'
PATCH 1/1 firmware: arm_scmi: Remove set but not used variable 'val'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/firmware/arm_scmi/perf.c: In function scmi_perf_fc_ring_db:drivers/firmware/arm_scmi/perf.c:323:7: warning: variable val set but not used [-Wunused-but-set-variable]
val is never used, so remove it.
--- drivers/firmware/arm_scmi/perf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/firmware/arm_scmi/perf.c +1 -3
@@ -319,10 +319,8 @@ static void scmi_perf_fc_ring_db(struct scmi_fc_db_info *db)SCMI_PERF_FC_RING_DB (64 );#else { -u64 val =0 ; -if (db->mask) - val =ioread64_hi_lo (db->addr) & db->mask; +ioread64_hi_lo (db->addr) & db->mask;iowrite64_hi_lo (db->set, db->addr); }#endif
Signature · 1 line
2.23.0
Quoted 18 lines · Zheng Yongjun
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/firmware/arm_scmi/perf.c: In functionscmi_perf_fc_ring_db:drivers/firmware/arm_scmi/perf.c:323:7: warning: variable val set but not used [-Wunused-but-set-variable]val is never used, so remove it.
Reported-by Hulk Robot <[email protected]>Signed-off-by Zheng Yongjun <[email protected]>--- drivers/firmware/arm_scmi/perf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/firmware/arm_scmi/perf.c +0
-0
drivers/firmware/arm_scmi/perf.c static void scmi_perf_fc_ring_db(struct scmi_fc_db_info *db) · line 324
Quoted 9 lines
drivers/firmware/arm_scmi/perf.c +1
-3@@ -319,10 +319,8 @@ static void scmi_perf_fc_ring_db(struct scmi_fc_db_info *db)SCMI_PERF_FC_RING_DB (64 );#else { -u64 val =0 ; -if (db->mask) - val =ioread64_hi_lo (db->addr) & db->mask; +ioread64_hi_lo (db->addr) & db->mask;iowrite64_hi_lo (db->set, db->addr);
FWIW, compared to the SCMI_PERF_FC_RING_DB() macro, this looks like the wrong "fix".
Robin.
Quoted 3 lines
drivers/firmware/arm_scmi/perf.c +0
-0}#endif
Quoted 23 lines · Robin Murphy
Quoted 22 lines · Zheng Yongjun
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/firmware/arm_scmi/perf.c: In functionscmi_perf_fc_ring_db:drivers/firmware/arm_scmi/perf.c:323:7: warning: variable val set but not used [-Wunused-but-set-variable]val is never used, so remove it.
Reported-by Hulk Robot <[email protected]>Signed-off-by Zheng Yongjun <[email protected]>--- drivers/firmware/arm_scmi/perf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/firmware/arm_scmi/perf.c +0
-1@@ -319,10 +319,8 @@ static void scmi_perf_fc_ring_db(struct scmi_fc_db_info *db)SCMI_PERF_FC_RING_DB (64 );#else { -u64 val =0 ;
Quoted 9 lines
drivers/firmware/arm_scmi/perf.c static void scmi_perf_fc_ring_db(struct scmi_fc_db_info *db) · line 324
Quoted 5 lines
drivers/firmware/arm_scmi/perf.c +1
-2-if (db->mask) - val =ioread64_hi_lo (db->addr) & db->mask; +ioread64_hi_lo (db->addr) & db->mask;iowrite64_hi_lo (db->set, db->addr);FWIW, compared to the
SCMI_PERF_FC_RING_DB()macro, this looks like the wrong "fix".
Yes, no idea how I didn't spot this earlier. That could be because this was just added to fix 32-bit build and wasn't tested.
The below patch should fix the warning and also fixes the real bug.
Regards,
Sudeep
drivers/firmware/arm_scmi/perf.c +1 -1
@@ -323,7 +323,7 @@ static void scmi_perf_fc_ring_db(struct scmi_fc_db_info *db)if (db->mask) val =ioread64_hi_lo (db->addr) & db->mask; - iowrite64_hi_lo(db->set, db->addr); + iowrite64_hi_lo(db->set | val, db->addr); }#endif }
PATCH 1/1 firmware: arm_scmi: Fix doorbell ring logic for !CONFIG_64BIT
In reply to Zheng YongjunThe logic to ring the scmi performance fastchannel ignores the value read from the doorbell register in case of !CONFIG_64BIT. This bug also shows up as warning with '-Wunused-but-set-variable' gcc flag:
drivers/firmware/arm_scmi/perf.c: In function scmi_perf_fc_ring_db:drivers/firmware/arm_scmi/perf.c:323:7: warning: variable val set but
not used [-Wunused-but-set-variable]
Fix the same by aligning the logic with CONFIG_64BIT as used in the macro SCMI_PERF_FC_RING_DB().
for performance protocol")
--- drivers/firmware/arm_scmi/perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Hi Zheng,
Thanks for the bug report, but the fix is incorrect as discussed. This is proper fix, let me know if this fixes the gcc warning you found.
Regards,
Sudeep
drivers/firmware/arm_scmi/perf.c +1 -1
@@ -323,7 +323,7 @@ static void scmi_perf_fc_ring_db(struct scmi_fc_db_info *db)if (db->mask) val =ioread64_hi_lo (db->addr) & db->mask; - iowrite64_hi_lo(db->set, db->addr); + iowrite64_hi_lo(db->set | val, db->addr); }#endif }
--
2.17.1