Re: [PATCH] firmware: arm_scmi: Remove set but not used variable 'val'

From: Robin Murphy
Date: Mon Nov 11 2019 - 10:50:02 EST


On 10/11/2019 10:30, Zheng Yongjun wrote:
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.

Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
Signed-off-by: Zheng Yongjun <zhengyongjun3@xxxxxxxxxx>
---
drivers/firmware/arm_scmi/perf.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 4a8012e3cb8c..efa98d2ee045 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -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.

}
#endif