From patchwork Wed Oct 21 10:29:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1385484 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=2a01:238:438b:c500:173d:9f52:ddab:ee01; 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=S5WltRtj; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CGRbg1js4z9sPB for ; Wed, 21 Oct 2020 21:30:55 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B350B82442; Wed, 21 Oct 2020 12:29:52 +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="S5WltRtj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B7ACE823FC; Wed, 21 Oct 2020 12:29:43 +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-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) (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 0528281F7C for ; Wed, 21 Oct 2020 12:29:30 +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-ej1-x642.google.com with SMTP id z5so2426505ejw.7 for ; Wed, 21 Oct 2020 03:29:30 -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=Aui9rAc0y/0pNsT3wxG6R4eGG5oX6rX7EPFwPDFMwxY=; b=S5WltRtjTBIixGKtr9tpeNwKTt6Z4qCciWFlwEXezo5TpFA/cJCcUfBAd6vymSC3Zt N/jhw2eh0leRBF/qNtDDDUHOqLPxphpaxc7VGHWRli+WLnvJXNH0pG+pxyRSFOMOG3KK ut6tLABq3on3tiLcbZf1mW7RhY9RT5IUR5l9oBoDnKCeqVr0fAbvNUKXvtQnGeaqbkk+ EH/PSQusIMyP8xwdahbd3lwEM6ix8KeArtCehTlaHYUGqnArAy6QmpYiC0BOorjB9S3Q cBqQq1A60br1PFYyrF7QhcjoRZVlOFm1x3gPBsps9R+u61bMWBgpRlHY/q51j9F8taG1 zyoQ== 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=Aui9rAc0y/0pNsT3wxG6R4eGG5oX6rX7EPFwPDFMwxY=; b=rh5DN6Q4zCeuorybtW0J1ZwzvD86PhEvAVWAeAY4gYRBvrWDYYCIh+1jqJg689V55y S/gRVLpo6cSkNVAVXDOBt888UZ4T5RZuIC1UfPwCJtDQCdIdwWjUTDExgpu99Y0QTs3I 4QpPphohiVtiwzqU3QFjRyOa0AMDOPOBWaxt4J/kJZpNUywNSq1HyOa+N2ub1aTe+k54 aPHKc3CBGyzkBcN8YrzFjAAeKgIOToQmQ92XOpmjo+IuQEA9/tLQ/VOqf6s1qlizGQdU ixMK4mozSD5MfyGYBPGrm7tWUtMv0J5tJUC/fJ86npryG635sAnTfqVRJd4MSjvsVpke pHDg== X-Gm-Message-State: AOAM532OfP/pcnw+uB37QHyiht3GaEZ8X/lroaQfm2gbY9FseYlKruen 0R7OKf8uLeB6BB9A1qweRhSF8UGIX2yclPyz X-Google-Smtp-Source: ABdhPJy0D1iPz5GE9etVwJ4vsrPrQ+p0LLxv9xOYGfsDmxq5fC30HuQQ4h29XmR4mFmL2XBgu5k+0Q== X-Received: by 2002:a17:907:2677:: with SMTP id ci23mr2728633ejc.270.1603276169436; Wed, 21 Oct 2020 03:29:29 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id q3sm1870700edv.17.2020.10.21.03.29.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Oct 2020 03:29:28 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Subject: [PATCH 3/4] xilinx: zynqmp: Do not check 0 as invalid return from snprintf Date: Wed, 21 Oct 2020 12:29:18 +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 U-Boot SPL on ZynqMP is using CONFIG_SPL_USE_TINY_PRINTF which doesn't return any return value and all the time returns 0. That's why even correct snprintf was returning in SPL chip ID as "unknown". Change checking condition and allow snprintf to return 0 which is according manual patch successful return. "If an output error is encountered, a negative value is returned." Fixes: 43a138956f7e ("arm64: zynqmp: Get rid of simple_itoa and replace it by snprintf") Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 7ba2c789751e..c4f24982843e 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -223,7 +223,7 @@ static char *zynqmp_get_silicon_idcode_name(void) /* Add device prefix to the name */ ret = snprintf(name, ZYNQMP_VERSION_SIZE, "zu%d", zynqmp_devices[i].device); - if (ret <= 0) + if (ret < 0) return "unknown"; if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_EV) {