From patchwork Fri Sep 11 08:12:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1362288 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=l/vfIVYK; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BnpRh5K8cz9sR4 for ; Fri, 11 Sep 2020 18:13:36 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AAD4C82319; Fri, 11 Sep 2020 10:13:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="l/vfIVYK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 75C6A822FD; Fri, 11 Sep 2020 10:13:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6F0C8822E3 for ; Fri, 11 Sep 2020 10:12:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-wr1-x441.google.com with SMTP id z1so10555432wrt.3 for ; Fri, 11 Sep 2020 01:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B9F0guuCeFv05bhmiT6c8j6bgXQiu2l6EemdeXM1TQk=; b=l/vfIVYKkWTtzk9gX0HaHMhYyQt/+E5OwwVsBwL4UV91sd71n0W8sECLHyD48h5UuW eA7bK7qNjekrFCGr5V12gJxuVNnF0G4Y+B7sEe4P2Kz+Mp6Kxj0f3E3L2IZRsUjXpLtN uod0SuzbsIFYEVgxjhoBE0m8Kyg3/25UYbnzvXn8xoW+Xt2TkyW/vmlKoqwhgom7a6HF IvE+gW3el3diei68m+mRTgaTae65kQDTZXYx3knGQfVzLOtZHHiKnZyX2zSFhYop1zUD 7KCtrvLycN2jcCMCJ28KR+bqUQ4R8v0dlWc2S06KiTsuTXbWYtAKIL2Ym+pntWiT09k6 hgrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=B9F0guuCeFv05bhmiT6c8j6bgXQiu2l6EemdeXM1TQk=; b=Hy7vuqFHc34pZJ5o4kYecblzcNt1qAj/gshN1m1mVQS67q3+DR5MAAwesPf+m+jOV2 gKsde58uPngUzPe1swFr/p8yIpdFVTM6W2jWxGvfKCoLxyP648b91CG4mtx/03ITepVW ZqK4g+CxRPikFDk0+ak+3QbyvMLA60S/rsEAE4J83pK87f4Da97d84EKUAFhPUZQ2gwG UweQ+BLn5Y7XkJgyv8dXRJu3RsxfkuihE7g7Ched+vbI5tC/NEz9V2IfKdD/XLroBVu+ 5VpBMqZexZ76xBtrtJ4JLmpUoEAac6AFRhTqGQPwXfZv4rtEcgbZI2XH3iU+6RIyYHA/ 9PzQ== X-Gm-Message-State: AOAM532l+WkjpTaiijeIuF6s44Gw1bvamtF9A6J3nTEsxuMLbojucWU0 JNxKRwLn9piGfR9Gq/iIoB/ZHKNE6i+ARw== X-Google-Smtp-Source: ABdhPJzStvzfw6wtJNMZlGWPTdvIlqtscFGe96LQyFf0PO6VxDpGBqy4FmtYb6LaxIS0Mr6r33PrMg== X-Received: by 2002:adf:f504:: with SMTP id q4mr781275wro.353.1599811978850; Fri, 11 Sep 2020 01:12:58 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id u13sm2870229wrm.77.2020.09.11.01.12.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Sep 2020 01:12:58 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Subject: [PATCH v2 3/3] xilinx: zynqmp: Remove one static variable Date: Fri, 11 Sep 2020 10:12:45 +0200 Message-Id: X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean There is no reason to have name variable saved in BSS section when it doesn't need to be really used. That's why remove static from variable definition and use strdup() to duplicate string with exact size from malloc area instead. Signed-off-by: Michal Simek --- (no changes since v1) board/xilinx/zynqmp/zynqmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 177e03906178..f5a88ac5d040 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -191,7 +191,7 @@ static char *zynqmp_get_silicon_idcode_name(void) { u32 i; u32 idcode, idcode2; - static char name[ZYNQMP_VERSION_SIZE]; + char name[ZYNQMP_VERSION_SIZE]; u32 ret_payload[PAYLOAD_ARG_CNT]; xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload); @@ -219,7 +219,7 @@ static char *zynqmp_get_silicon_idcode_name(void) return "unknown"; /* Add device prefix to the name */ - strncat(name, "zu", 2); + strncpy(name, "zu", ZYNQMP_VERSION_SIZE); strncat(&name[2], simple_itoa(zynqmp_devices[i].device), 2); if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_EV) { @@ -269,7 +269,7 @@ static char *zynqmp_get_silicon_idcode_name(void) debug("Variant not identified\n"); } - return name; + return strdup(name); } #endif