* [PATCH] ata: acard-ahci: removeset but not used variable 'n_elem'
@ 2019-12-13 3:11 Hongbo Yao
2019-12-13 9:03 ` Sergei Shtylyov
0 siblings, 1 reply; 2+ messages in thread
From: Hongbo Yao @ 2019-12-13 3:11 UTC (permalink / raw)
To: axboe; +Cc: yaohongbo, linux-ide, linux-kernel, linuxarm
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/ata/acard-ahci.c: In function acard_ahci_qc_prep:
drivers/ata/acard-ahci.c:268:15: warning: variable n_elem set but not
used [-Wunused-but-set-variable]
It is never used so can be removed. acard_ahci_fill_sg() is called only
in one place, use 'void' instead of 'int'.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Hongbo Yao <yaohongbo@huawei.com>
---
drivers/ata/acard-ahci.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c
index 46dc54d18f0b..0613c1269292 100644
--- a/drivers/ata/acard-ahci.c
+++ b/drivers/ata/acard-ahci.c
@@ -179,7 +179,7 @@ static void acard_ahci_pci_print_info(struct ata_host *host)
ahci_print_info(host, scc_s);
}
-static unsigned int acard_ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl)
+static void acard_ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl)
{
struct scatterlist *sg;
struct acard_sg *acard_sg = cmd_tbl + AHCI_CMD_TBL_HDR_SZ;
@@ -206,8 +206,6 @@ static unsigned int acard_ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl)
}
acard_sg[last_si].size |= cpu_to_le32(1 << 31); /* set EOT */
-
- return si;
}
static enum ata_completion_errors acard_ahci_qc_prep(struct ata_queued_cmd *qc)
@@ -218,7 +216,6 @@ static enum ata_completion_errors acard_ahci_qc_prep(struct ata_queued_cmd *qc)
void *cmd_tbl;
u32 opts;
const u32 cmd_fis_len = 5; /* five dwords */
- unsigned int n_elem;
/*
* Fill in command table information. First, the header,
@@ -232,9 +229,8 @@ static enum ata_completion_errors acard_ahci_qc_prep(struct ata_queued_cmd *qc)
memcpy(cmd_tbl + AHCI_CMD_TBL_CDB, qc->cdb, qc->dev->cdb_len);
}
- n_elem = 0;
if (qc->flags & ATA_QCFLAG_DMAMAP)
- n_elem = acard_ahci_fill_sg(qc, cmd_tbl);
+ acard_ahci_fill_sg(qc, cmd_tbl);
/*
* Fill in command slot information.
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ata: acard-ahci: removeset but not used variable 'n_elem'
2019-12-13 3:11 [PATCH] ata: acard-ahci: removeset but not used variable 'n_elem' Hongbo Yao
@ 2019-12-13 9:03 ` Sergei Shtylyov
0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2019-12-13 9:03 UTC (permalink / raw)
To: Hongbo Yao, axboe; +Cc: linux-ide, linux-kernel, linuxarm
On 13.12.2019 6:11, Hongbo Yao wrote:
Space missing in the subject...
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/ata/acard-ahci.c: In function acard_ahci_qc_prep:
> drivers/ata/acard-ahci.c:268:15: warning: variable n_elem set but not
> used [-Wunused-but-set-variable]
>
> It is never used so can be removed. acard_ahci_fill_sg() is called only
> in one place, use 'void' instead of 'int'.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Hongbo Yao <yaohongbo@huawei.com>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-13 9:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13 3:11 [PATCH] ata: acard-ahci: removeset but not used variable 'n_elem' Hongbo Yao
2019-12-13 9:03 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).