From patchwork Tue Nov 7 17:34:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 741911 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1748461wrr; Tue, 7 Nov 2023 09:34:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEH1BlELcooZsoz4vdtBP0yNAN7bXci8RHpF6EQXzzSZUyEGb+gNwjgG71ZTuTqvA95THUE X-Received: by 2002:a17:907:c084:b0:9de:dc3d:3b2 with SMTP id st4-20020a170907c08400b009dedc3d03b2mr8274952ejc.16.1699378463851; Tue, 07 Nov 2023 09:34:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699378463; cv=none; d=google.com; s=arc-20160816; b=bBUb0sIgsxf3v4UB+Fjhw7zsmWCbUM7rtKd3YyeAgboQ+17/Dmo1N9BjIOKeIu7+gr BVV6C6aBhHwDR5YfOfarZchN8krPNKHybZwkO8Vs39z5/ze90XUAqkvCwRwvRVTZSxnU 0j6FW5b57o4rKzC3ocKgZyZblYxnqyfGU6k2BYSxonRhgBdqMqifcqzFn7d9Ivf58RMA ciybDEJOhPg2tGjtlqUkGBL0bUjjT+4PoUiHw+XCWl4vI1Rz1rWoJUsD/lAzv25FX0DJ g2Wz/DSOhFsVEcnIFq8dfBZwzF6qfyJBxS6DxrNcEZJbbKITxfOWH3OWtpmx6aFQ2wig tSfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=fKkH8KoxucMcGLYOaOq1FaSa9vHcjOF0apPPKbIMCS4=; fh=jkaJ/YEdDCsD4CvMxjuN1nDQgnmr48gKiavmvpSlGAU=; b=w1+U1NhZgoh1RJsEeavnO/GCFmLP6X+6nxSCJ4hVmkgNNXQXLCzbjRcpfSMBrgogoX 0ddORqVXB6UoKPE+uGvI0y9xpPzOudninyVEDFp76dbLaupmIq77WPKmd8JFDaAmaIYJ 2kkCAywZdLeoI4FjKcGks7wTi6BXI83INimh7mUkyww7kEAWmZ1WYJQvoczVEanDgEdS /EbaFYoW8fomRxVwy26/uLrYfFLXZaX9spDUjIzhClPXQvAuo5doKVUBsRrnfcDPw0nX 50e2zGDDKP5/A+BV8ox7Sv/JA4HHjWpDchRfCtxif+iIG/bpn6Kmt5GAFFtPm7YGXITJ hknQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J3QsI7Jv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id qf4-20020a1709077f0400b009b653f79463si1170789ejc.170.2023.11.07.09.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 09:34:23 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J3QsI7Jv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF56A871E9; Tue, 7 Nov 2023 18:34:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="J3QsI7Jv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1C3D486F9F; Tue, 7 Nov 2023 18:34:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (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 0FF4D86F9F for ; Tue, 7 Nov 2023 18:34:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6d31f3e8ca8so3615808a34.0 for ; Tue, 07 Nov 2023 09:34:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699378458; x=1699983258; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fKkH8KoxucMcGLYOaOq1FaSa9vHcjOF0apPPKbIMCS4=; b=J3QsI7Jvu0T4yICBTwl5r7X4pNpan8nenIALXqJe5hllJyr2z5JA5En1uNSE163JfT r9rrI1rQoruk1VgbZSvJpmGGuNQ7Zqt833aAX33WlHX1WGuD4u6/oj6AJLRJ7rN1I0M5 fZPiaDMpXDJdp0N5b6yUN3fqGHy0zpKbF9xXkYpvtwH65AqXeVYpa54Q5X/HV0QfAgld GcEKOp0/KrjRzOdLAcu8USGA8bs8sp07w+TxzD2JQp6rgvSCqd5PHTnx19E2NnOXKjvY zFpF4s7/YBrKSpzKDv8hsmMHzNUszU8TcNfNLNdrILorMJ/sTxwYKBJwoFrj7h9c2iek 1mEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699378458; x=1699983258; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fKkH8KoxucMcGLYOaOq1FaSa9vHcjOF0apPPKbIMCS4=; b=M49TY6EZLacSY+IQFHTEkWJqt4FsB4PuCvRAkbniYRR3uAmYVtXunDcWG/ho581+OC KU9rcv7oNOCRolxLgj70KgYbXJn+28IlIR9XkYMTwctv6+HZRQvO0Hakl95yACL5wG7s MIWw8H/YtV17A5mRBfuIrW6ojrpkjr3Kh3tRKO6IQNVysDTXHeq6WI5HUKB4Dxphfu/I L7nJQ96xRV3bjmwkNa4X+Wo64X+a2BPUEo4RRn+HaiS6/X15Zse1os1vgI5Le9qmdcjt RUyiHnXTCc+zRnSyu1g1vT7cecJDzMMQxe7Lhmyie510/vFZtEc2kXwz9gBPCNv01dkQ AErA== X-Gm-Message-State: AOJu0Yy0gz0cN8nvjz/qBPEgJf1wa4Hv1RHjfYQ5VnTD/nNQBsBOGVDP SwSbx5Oe0zVnYmeXrJXyRtyt/Q== X-Received: by 2002:a05:6830:104d:b0:6c4:d7e4:94d2 with SMTP id b13-20020a056830104d00b006c4d7e494d2mr32527561otp.33.1699378458409; Tue, 07 Nov 2023 09:34:18 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id az5-20020a056830458500b006c4727812fdsm1643297otb.15.2023.11.07.09.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 09:34:17 -0800 (PST) From: Sam Protsenko To: Simon Glass , Tom Rini Cc: Mark Kettenis , Minkyu Kang , Thomas Abraham , u-boot@lists.denx.de Subject: [PATCH] serial: s5p: Fix clk_get_by_index() error code check Date: Tue, 7 Nov 2023 11:34:17 -0600 Message-Id: <20231107173417.8254-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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 clk_get_by_index() returns negative number on error. Assigning it to unsigned int makes the subsequent "ret < 0" check always false, leading in turn to possible unhandled errors. Change 'ret' variable type to signed int so the code checks and handles clk_get_by_index() return code properly. Signed-off-by: Sam Protsenko Fixes: cf75cdf96ef2 ("serial: s5p: use clock api to get clock rate") --- drivers/serial/serial_s5p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index 7aeb8c0f8cb7..fe52580d64de 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -118,7 +118,7 @@ int s5p_serial_setbrg(struct udevice *dev, int baudrate) #if IS_ENABLED(CONFIG_CLK_EXYNOS) || IS_ENABLED(CONFIG_ARCH_APPLE) struct clk clk; - u32 ret; + int ret; ret = clk_get_by_index(dev, 1, &clk); if (ret < 0)