Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 462098b0 authored by Levente Kurusa's avatar Levente Kurusa Committed by Tejun Heo
Browse files

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: default avatarLevente Kurusa <levex@linux.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 6ce4eac1
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -2402,7 +2402,7 @@ static void ata_eh_link_report(struct ata_link *link)
	struct ata_port *ap = link->ap;
	struct ata_port *ap = link->ap;
	struct ata_eh_context *ehc = &link->eh_context;
	struct ata_eh_context *ehc = &link->eh_context;
	const char *frozen, *desc;
	const char *frozen, *desc;
	char tries_buf[6];
	char tries_buf[6] = "";
	int tag, nr_failed = 0;
	int tag, nr_failed = 0;


	if (ehc->i.flags & ATA_EHI_QUIET)
	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)
	if (ap->pflags & ATA_PFLAG_FROZEN)
		frozen = " frozen";
		frozen = " frozen";


	memset(tries_buf, 0, sizeof(tries_buf));
	if (ap->eh_tries < ATA_EH_MAX_TRIES)
	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);
			 ap->eh_tries);


	if (ehc->i.dev) {
	if (ehc->i.dev) {