From patchwork Tue Oct 29 19:01:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Levente Kurusa X-Patchwork-Id: 287025 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A32C42C0365 for ; Wed, 30 Oct 2013 06:02:06 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751088Ab3J2TBv (ORCPT ); Tue, 29 Oct 2013 15:01:51 -0400 Received: from mail-ee0-f44.google.com ([74.125.83.44]:34217 "EHLO mail-ee0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751305Ab3J2TBt (ORCPT ); Tue, 29 Oct 2013 15:01:49 -0400 Received: by mail-ee0-f44.google.com with SMTP id c4so133916eek.31 for ; Tue, 29 Oct 2013 12:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=MS1TS2M1l7zOn1Sy1qykCTWBoFnLJZ8kpxnWTbC5m3I=; b=q6fV7hyWNR52hY9rdSHYP/0lqtoYEikWbs+g9WqiZqdfHwn7W3RUvx53dnN+VpppFr ltuYdGrxd7yj5Nt1VL4jCXpK4m5JhvmfgYwvRkEBX5uy5LbQ/xa+FwHWQhyO/6rl+svO 51luVJ+4nkok2qEFXD1o7EEXZbwieony5skRWwf9DmjGH+ZjAKPB6dHnBo7pzu5tXXGz FyzPj6P8dzSACngqk8u/cqylNVsk8t5mEC5w6w/x/+WkVyb1eraEJH+hrlIrfdHoGRef d58it4Ws7hrkAZEoa313FAa+HcL/7z1svqVTZYDD2yJCe7t7eIG0LwAYiP/K6KtiX8HM HjiA== X-Received: by 10.14.29.67 with SMTP id h43mr1044122eea.7.1383073308274; Tue, 29 Oct 2013 12:01:48 -0700 (PDT) Received: from [192.168.1.10] (mail.mediaweb.hu. [62.201.96.214]) by mx.google.com with ESMTPSA id m54sm73653856eex.2.2013.10.29.12.01.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Oct 2013 12:01:47 -0700 (PDT) Message-ID: <5270061A.3080108@linux.com> Date: Tue, 29 Oct 2013 20:01:46 +0100 From: Levente Kurusa User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Tejun Heo , LKML , Linux IDE/ATA Dev Subject: [PATCH trivial v2] ata: libata-eh: Remove unnecessary snprintf arithmetic Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org 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 --- -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index f9476fb..b7c4146 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2394,7 +2399,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) @@ -2425,9 +2432,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) {