diff options
author | Levente Kurusa <levex@linux.com> | 2013-10-29 20:01:46 +0100 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-11-22 23:21:10 +0100 |
commit | 462098b090897fbcf00088b225eb7a3adc407e98 (patch) | |
tree | 5eb3e3b5f30e0103f30b32e93ccdf3230089f4c4 /drivers/ata | |
parent | Linux 3.13-rc1 (diff) | |
download | linux-462098b090897fbcf00088b225eb7a3adc407e98.tar.xz linux-462098b090897fbcf00088b225eb7a3adc407e98.zip |
ata: libata-eh: Remove unnecessary snprintf arithmetic
Remove an unnecessary arithmetic operation from a call to snprintf, because
the size parameter of snprintf includes the trailing null space.
Also, initialize the buffer on definition instead of a memset call.
Signed-off-by: Levente Kurusa <levex@linux.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-eh.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 92d7797223be..6d8757008318 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2402,7 +2402,7 @@ static void ata_eh_link_report(struct ata_link *link) struct ata_port *ap = link->ap; struct ata_eh_context *ehc = &link->eh_context; const char *frozen, *desc; - char tries_buf[6]; + char tries_buf[6] = ""; int tag, nr_failed = 0; if (ehc->i.flags & ATA_EHI_QUIET) @@ -2433,9 +2433,8 @@ static void ata_eh_link_report(struct ata_link *link) if (ap->pflags & ATA_PFLAG_FROZEN) frozen = " frozen"; - memset(tries_buf, 0, sizeof(tries_buf)); if (ap->eh_tries < ATA_EH_MAX_TRIES) - snprintf(tries_buf, sizeof(tries_buf) - 1, " t%d", + snprintf(tries_buf, sizeof(tries_buf), " t%d", ap->eh_tries); if (ehc->i.dev) { |