From nobody Mon Sep 16 14:45:50 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X6nlg2gJsz5WB8t; Mon, 16 Sep 2024 14:45:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X6nlg0gD0z47Xx; Mon, 16 Sep 2024 14:45:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726497951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OG+ngt8ZEU3jNPQeJ1m9VJC2ufuoTbTlSvt1wNrQPMg=; b=V9+O1yD2j4Li6mguOTVj1L1QAWh5cG31oziGxLetz2fRhODKbt65S/xpSOae62IxfU3QNL 012qeYH3VR8GtrWS6ov8oXfKLWgvxrWdjw9oSIpsWGIdNBxyi49ZTCKwwKyGrtpZOSrRjB ljZVxF+HIGAhcTQWErPmJJB1bkMJ3EsocUbByNTGICl9M20M7/21AWkocRVf8e5NbSvinf Xmyjwshu73nnf6+7ITlqHc76OflV9d9L3RJr00L+pVwdrScSLbEMs7BlmgV6ZAags5qiQo 9hW1Y3VV5iuEED7krhsF5If1KgUHCSZO7XQqqyIZKm0CMrxjeuXmYJn6Nf0fcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726497951; a=rsa-sha256; cv=none; b=eo9PCjK0Fwzej0W9pkYDhhblHwe5cnLM/idh7zC2RdNpaLABR3Y1KSqL9yP+GT2ifvuKPV o3JDM5/4KOPv3CpuBvxMZaQvtC3wdj3lm4neRr/xYhzLqkeclIjE4nEXnDmBZNHcRWEf0h yyq6v10OCJ5iOfn0HAB1I3uZYayeWlsuoKU/Gz6pD7gdJplpcZ+CZgioAa/nD5/3Ono3CX nmM4La+pOKijBfCqpgkDnwkadfc+25QdyEwSK/nEJS+clspIAD51BT0OVCCgrwGZjN68Ov hsAV9W42HrSbB+egJgq+eweqptkGtqUOzwI5MuetbJQwcg156aUhcHkGyJ82Ww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726497951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OG+ngt8ZEU3jNPQeJ1m9VJC2ufuoTbTlSvt1wNrQPMg=; b=YYrISpXBZ247Z07HJqDtP1reju6JXW1NQ3c95ndirUzrrwu1oDAtCpXQ0SNzaZAbx7YnK1 4Wf1aBgMsoe5QBKwUi7ITdI8JC5d8Mkv2r343hHHcYZP0S0ScBK0L2C3oTshw6XfuhMhPM 0UptnEH6T1nkZi3cdiOqVQ+UdavqqaQd34ydjGuuNbOk9cK9Qt4pxwfzFw2oN3YrO+V7xo LFuINn6hKR+eJcKE8f/QEwi7TLGAIUj/yuBQLLAlnlA3hqDfAPdIgXws6bJLIxYkqD7Dtk po6U1LKwSVO6wuguJsDRiTqfnGOdcwCB0wdpJMZCiXxDpfRIwgfOV+6HUplc8w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4X6nlg08kyzyLs; Mon, 16 Sep 2024 14:45:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48GEjocJ090647; Mon, 16 Sep 2024 14:45:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48GEjolf090644; Mon, 16 Sep 2024 14:45:50 GMT (envelope-from git) Date: Mon, 16 Sep 2024 14:45:50 GMT Message-Id: <202409161445.48GEjolf090644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tom Jones Subject: git: 855c3dacfc6a - main - imx clk: Skip reconfiguring the clock if we don't have a new best_parent List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: thj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 855c3dacfc6a1565a75086e64a154dece3ccf5fa Auto-Submitted: auto-generated The branch main has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=855c3dacfc6a1565a75086e64a154dece3ccf5fa commit 855c3dacfc6a1565a75086e64a154dece3ccf5fa Author: Tom Jones AuthorDate: 2024-09-16 14:43:31 +0000 Commit: Tom Jones CommitDate: 2024-09-16 14:45:26 +0000 imx clk: Skip reconfiguring the clock if we don't have a new best_parent imx_clk_composite_find_best_parent can fail, when it does for all the clocks checked we attempt to configure an uninitialized best_parent leading to a panic. Initialize best_parent and skip reconfiguring the clock if we don't find a new best_parent to use. Reviewed By: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46662 --- sys/arm64/freescale/imx/clk/imx_clk_composite.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/arm64/freescale/imx/clk/imx_clk_composite.c b/sys/arm64/freescale/imx/clk/imx_clk_composite.c index 1d5ab5908d8c..3d2ef06fb8a2 100644 --- a/sys/arm64/freescale/imx/clk/imx_clk_composite.c +++ b/sys/arm64/freescale/imx/clk/imx_clk_composite.c @@ -217,6 +217,7 @@ imx_clk_composite_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout p_names = clknode_get_parent_names(clk); best_diff = 0; + best_parent = -1; for (p_idx = 0; p_idx != clknode_get_parents_num(clk); p_idx++) { p_clk = clknode_find_by_name(p_names[p_idx]); @@ -243,6 +244,10 @@ imx_clk_composite_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout if (best_diff == INT64_MAX) return (ERANGE); + /* If we didn't find a new best_parent just return */ + if (best_parent == -1) + return (0); + if ((flags & CLK_SET_DRYRUN) != 0) { *fout = best; return (0);