Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 65D77C7619A for ; Mon, 27 Mar 2023 11:01:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BE18185D3A; Mon, 27 Mar 2023 13:01:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=metanate.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=metanate.com header.i=@metanate.com header.b="HO7aYBUJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 181A086093; Mon, 27 Mar 2023 13:01:25 +0200 (CEST) Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DD90F85D13 for ; Mon, 27 Mar 2023 13:01:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=metanate.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=john@metanate.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Content-Type:Reply-To: Content-ID:Content-Description; bh=xqpbs+fSVeTktdrqEeWsdymTRHtqP4Ie6w+lZ5dytSA=; b=HO7aYBUJMqg9kCjWNzTaKPdHVn 5mt96LBDTAc0zrEFSgDO4mejZH7N5EGmt0oUwqhWcFC/gLZSIJlnodmRQw9GO1tvDfOQshnFdw+/E rPCakJGhWX+FiByJbjTtbiQ3rNl3Q6oDbQVkiGZflSmTKLsuHEb91xEehS7QiOTytbptvmC8oGhQw 569QfSkyFqYWzRJEB9X0PNG1cf6vMJOWGgwgEZDkfsQNjYYvPhUjaTyJV98PhScSqoeri+KjDCDT3 HNmrmtqPqr2ZI5tW/JW5GOvnswXH3GeMcm+sc9wykoWlBB24s6K73+cTGj3JA8bODyjih1xfhhFuF C1/Ob6TA==; Received: from [81.174.171.191] (helo=donbot.metanate.com) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pgkbF-00079X-L0; Mon, 27 Mar 2023 12:01:18 +0100 From: John Keeping To: u-boot@lists.denx.de Cc: Simon Glass , Philipp Tomsich , Kever Yang , Jonas Karlman , John Keeping Subject: [PATCH v3 1/3] rockchip: misc: fix misc_read() return check Date: Mon, 27 Mar 2023 12:01:08 +0100 Message-Id: <20230327110110.1312992-2-john@metanate.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230327110110.1312992-1-john@metanate.com> References: <20230327110110.1312992-1-john@metanate.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated: YES X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean misc_read() is documented to return the number of bytes read or a negative error value. The Rockchip drivers currently do not implement this correctly and instead return zero on success or a negative error value. In preparation for fixing the drivers, fix the condition here to only error on negative values. Suggested-by: Jonas Karlman Signed-off-by: John Keeping --- v3: new patch arch/arm/mach-rockchip/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c index 849014d2fb..7d03f0c2b6 100644 --- a/arch/arm/mach-rockchip/misc.c +++ b/arch/arm/mach-rockchip/misc.c @@ -83,7 +83,7 @@ int rockchip_cpuid_from_efuse(const u32 cpuid_offset, /* read the cpu_id range from the efuses */ ret = misc_read(dev, cpuid_offset, cpuid, cpuid_length); - if (ret) { + if (ret < 0) { debug("%s: reading cpuid from the efuses failed\n", __func__); return -1; -- 2.40.0