From patchwork Thu Oct 24 03:34:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhangzekun (A)" X-Patchwork-Id: 13848280 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BD1D15B543 for ; Thu, 24 Oct 2024 03:39:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729741158; cv=none; b=JCQLdQgxqlWGJZTNAAupUcwx7ypXaBfPwV7/ppiMHe8uQ/h1FAQEq66ENSF+yJDvE+GMu7ODmCQoYZiXcjW9kygSStg5ms/Cflaf68V8wCr543qPEZLpY0iYAWIu3hb/ADFkHkWBoEos0R8YNsuyDhaeC+wKxahBrf2g5NTSNjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729741158; c=relaxed/simple; bh=VnAyf1t3SWlaAaDHBJmgxAmvm+OOiSLwPEYNcOySnT4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WDJ3BBuREmXx64agH9/1lah4GUj/8QCvmdQ1VAcyLBvfr1EFAX0moFRuikZrgjmBZtSlq6MvnsdGgAqNDgfVvBhrZdxTuTxUtGKa0rLYeF5N3/+8JyfXILJZesC+8JD3PxbSXwjB+/7NCZQ9Fq9TbtYE3gCcBnWD+N3/LgGIH6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4XYs790XckzyTkg; Thu, 24 Oct 2024 11:37:41 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 4D3671800A7; Thu, 24 Oct 2024 11:39:13 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemf500003.china.huawei.com (7.202.181.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 24 Oct 2024 11:39:12 +0800 From: Zhang Zekun To: , , , , , , , , , , CC: , Subject: [RESEND PATCH 1/4] clk: imx: scu: Fix the return of uninitialized variable Date: Thu, 24 Oct 2024 11:34:21 +0800 Message-ID: <20241024033424.115417-2-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241024033424.115417-1-zhangzekun11@huawei.com> References: <20241024033424.115417-1-zhangzekun11@huawei.com> Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemf500003.china.huawei.com (7.202.181.241) The of_property_read_u32() can fail and leave the variable uninitialized, which will then be used. Return error if reading the property failed. Fixes: 77d8f3068c63 ("clk: imx: scu: add two cells binding support") Signed-off-by: Zhang Zekun --- drivers/clk/imx/clk-scu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index b1dd0c08e091..95798c6fea1c 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -194,7 +194,7 @@ static bool imx_scu_clk_is_valid(u32 rsrc_id) int imx_clk_scu_init(struct device_node *np, const struct imx_clk_scu_rsrc_table *data) { - u32 clk_cells; + u32 clk_cells = 0; int ret, i; ret = imx_scu_get_handle(&ccm_ipc_handle); From patchwork Thu Oct 24 03:34:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhangzekun (A)" X-Patchwork-Id: 13848282 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E83E916A92D for ; Thu, 24 Oct 2024 03:39:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729741160; cv=none; b=YH8+ALH3xxAzkNhHJLpd1nRpfFkepYElYXlybu6xxTx5esHfzzXCpXyohti9B5SLJ8M5W5NexNOZBsp68zZ/rNxtG7MClDVZ1sNBuaPS97XIauKBR6pS4Ji9tVRU2ZcBprYm1vayGKMJpnVukpORXl8BC7eVDSF0igOAvIfloS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729741160; c=relaxed/simple; bh=Hc6DILxPQqL3l9UGsJ6qJ7xZnzZVgV80MBG0G0HvsjU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TEOQMs6qNmimEDHhy25avKv8A/R9/QNAuy5o4FPMKf1fMw9T1LKB8WB3JnEGZlYHHYDVYzwP7w4kY1QTY0V/Az6w3+K3kVYqfp0yFlc6SZY9APaldK6/iLC5+AMn+Yp57bTQBzXku669YHxpCkmbe0aeDkvqiSC4qYJJiBuI1iM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4XYs7x3q0czQs4B; Thu, 24 Oct 2024 11:38:21 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 425CE1800A7; Thu, 24 Oct 2024 11:39:14 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemf500003.china.huawei.com (7.202.181.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 24 Oct 2024 11:39:13 +0800 From: Zhang Zekun To: , , , , , , , , , , CC: , Subject: [RESEND PATCH 2/4] clk: socfpga: Fix the use of uninitialized variable Date: Thu, 24 Oct 2024 11:34:22 +0800 Message-ID: <20241024033424.115417-3-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241024033424.115417-1-zhangzekun11@huawei.com> References: <20241024033424.115417-1-zhangzekun11@huawei.com> Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemf500003.china.huawei.com (7.202.181.241) The of_property_read_u32() can fail and leave the variable uninitialized, which will then be used. Return before using the uninitialized variable. Fixes: 97259e99bdc9 ("clk: socfpga: split clk code") Signed-off-by: Zhang Zekun --- drivers/clk/socfpga/clk-periph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/socfpga/clk-periph.c b/drivers/clk/socfpga/clk-periph.c index 6a4075147b9c..ec4234d9daa1 100644 --- a/drivers/clk/socfpga/clk-periph.c +++ b/drivers/clk/socfpga/clk-periph.c @@ -60,7 +60,8 @@ static void __init __socfpga_periph_init(struct device_node *node, u32 fixed_div; u32 div_reg[3]; - of_property_read_u32(node, "reg", ®); + if (of_property_read_u32(node, "reg", ®)) + return; periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL); if (WARN_ON(!periph_clk)) From patchwork Thu Oct 24 03:34:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhangzekun (A)" X-Patchwork-Id: 13848281 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3ADDE16A397 for ; Thu, 24 Oct 2024 03:39:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729741160; cv=none; b=qNtFS1c1juEuq/NY2zPxBg+/Z8AnJyf1OBS6NMgs7NbRk8Q5i6mC/WbbcYZIUitCSsl42uX2r7D9oS1Fb8YHbcbNd6Vu+FV2btK+mdN1Oss9Gp+tMDnhwHgKCJyDfnyMMilzIp8tpFQZX2/yWEXfsbv8KnTswI4nVIZ47RR3avk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729741160; c=relaxed/simple; bh=PPIsEL5LF9mJFzMsAGTKPsIaw0O33KO5VwU5DgaVocU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XOroiiRiqmh2nZKYJSzBZVmPA7nDwmgW4xtba4yQ9YBxKCeUABeussgIH7qFPezBG1l9tbXOAqrjM/Rzh6Xw2bir8BKayppXNYra4EOSf8MFn04QbzoPhmRPZwR4d5G0R0ru7S2x6FJ2zClRqhNsSTA6SQoDW+CrkbPI6EamR1E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4XYs3x3rS3z1HLP2; Thu, 24 Oct 2024 11:34:53 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 3C3691A016C; Thu, 24 Oct 2024 11:39:15 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemf500003.china.huawei.com (7.202.181.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 24 Oct 2024 11:39:14 +0800 From: Zhang Zekun To: , , , , , , , , , , CC: , Subject: [RESEND PATCH 3/4] clk: socfpga: arria10: Fix the use of uninitialized variable Date: Thu, 24 Oct 2024 11:34:23 +0800 Message-ID: <20241024033424.115417-4-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241024033424.115417-1-zhangzekun11@huawei.com> References: <20241024033424.115417-1-zhangzekun11@huawei.com> Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemf500003.china.huawei.com (7.202.181.241) The of_property_read_u32() can fail and leave the variable uninitialized, which will then be used. Return before using the uninitialized variable. Fixes: 5343325ff3dd ("clk: socfpga: add a clock driver for the Arria 10 platform") Signed-off-by: Zhang Zekun --- drivers/clk/socfpga/clk-pll-a10.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/socfpga/clk-pll-a10.c b/drivers/clk/socfpga/clk-pll-a10.c index b028f25c658a..c01451400faa 100644 --- a/drivers/clk/socfpga/clk-pll-a10.c +++ b/drivers/clk/socfpga/clk-pll-a10.c @@ -76,7 +76,8 @@ static void __init __socfpga_pll_init(struct device_node *node, int rc; int i = 0; - of_property_read_u32(node, "reg", ®); + if (of_property_read_u32(node, "reg", ®)) + return; pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); if (WARN_ON(!pll_clk)) From patchwork Thu Oct 24 03:34:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhangzekun (A)" X-Patchwork-Id: 13848283 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7577616A397 for ; Thu, 24 Oct 2024 03:39:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729741162; cv=none; b=mjTz/zU5WipEQQy9zDlu2a0xvkCA8vAmJUWQYSIxnXi53FY+HL3ao5QIC0RHVORu+zAMv+oLaG5LEXFN9KQWZcPJtWCWgf8ns06boUqSDjrRrpP4bZrwIgmMNuysqpvTfiWfe1FDMLWdMpxwMI7kGv/u0kxGh7WBfWUra1X6Zts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729741162; c=relaxed/simple; bh=8fd4Mcz9d/Dg4W389ZyHJuBMUL0wE2AvyQGU3KncKZU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=opG/6XUpjWplMNzo3qIKoQ+xnVH6a9SUiFmzY+qb8aJyxCkIjiiVxN+mON8hXVFItuWG5qDrMISifh4VYosATkSdy0kjha2bH9dBs87jQZCFOoBb89lll7OTvHEvWGcfKCE6xNQRJgsJoiwqDYzxIHHdz64yYfK6EtrHX1XtmbU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4XYs6l2kZmzpXQ7; Thu, 24 Oct 2024 11:37:19 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 3686E1401E9; Thu, 24 Oct 2024 11:39:16 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemf500003.china.huawei.com (7.202.181.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 24 Oct 2024 11:39:15 +0800 From: Zhang Zekun To: , , , , , , , , , , CC: , Subject: [RESEND PATCH 4/4] clk: socfpga: clk-pll: Fix the use of uninitialized variable Date: Thu, 24 Oct 2024 11:34:24 +0800 Message-ID: <20241024033424.115417-5-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241024033424.115417-1-zhangzekun11@huawei.com> References: <20241024033424.115417-1-zhangzekun11@huawei.com> Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemf500003.china.huawei.com (7.202.181.241) The of_property_read_u32() can fail and leave the variable uninitialized, which will then be used. Return before using the uninitialized variable. Fixes: 97259e99bdc9 ("clk: socfpga: split clk code") Signed-off-by: Zhang Zekun --- drivers/clk/socfpga/clk-pll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c index 9dcc1b2d2cc0..9c3ce45cb907 100644 --- a/drivers/clk/socfpga/clk-pll.c +++ b/drivers/clk/socfpga/clk-pll.c @@ -82,7 +82,8 @@ static void __init __socfpga_pll_init(struct device_node *node, struct device_node *clkmgr_np; int rc; - of_property_read_u32(node, "reg", ®); + if (of_property_read_u32(node, "reg", ®)) + return; pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); if (WARN_ON(!pll_clk))