From patchwork Wed Oct 9 06:32:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 13827606 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 3846B433B5 for ; Wed, 9 Oct 2024 06:36:51 +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=1728455813; cv=none; b=LTAJ2wrO4lKYWrBX83TuanZbbNZHKV0ra3jPogEwVFb0qRR+ieuzERicOgWAq/f1iZCRWj8n9MzQ5qUo+3Ev2I+m8PbJgcxdcgDVqVrCYMjSJXH7ZG219r6WbXrL0YJS/8sLhVtJXX8i1/VSjCYxrtgIdo8Gax/yvhCCS8HPKtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728455813; c=relaxed/simple; bh=VnAyf1t3SWlaAaDHBJmgxAmvm+OOiSLwPEYNcOySnT4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U3hKNLNWY/utJoKaDl/DcGj6pSkJrUQj4xBnYpPzKodmCZur7yfBknj8yw7ehTHjPb9fTRShEzz90Jq+48v3HuMLy/4p+1AB8RxVD10Hvm5+Q4ZT1v7R6wiFKIzWAe7e/ziCw+gDqiVlbJLrOQZAkWj+yMP36O/lxSsJTCM6WDM= 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 4XNjm100pYzfd68; Wed, 9 Oct 2024 14:34:24 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id A585F140132; Wed, 9 Oct 2024 14:36:48 +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; Wed, 9 Oct 2024 14:36:47 +0800 From: Zhang Zekun To: , , , , , , , CC: , Subject: [PATCH 1/4] clk: imx: scu: Fix the return of uninitialized variable Date: Wed, 9 Oct 2024 14:32:26 +0800 Message-ID: <20241009063229.121258-2-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241009063229.121258-1-zhangzekun11@huawei.com> References: <20241009063229.121258-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: dggems705-chm.china.huawei.com (10.3.19.182) 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 Wed Oct 9 06:32:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 13827607 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 0751A154BE3 for ; Wed, 9 Oct 2024 06:36:51 +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=1728455813; cv=none; b=klfPnfV+SD5xZlmpiw0TnCiE+AgSQFUOr6hz9zs+BCPVxbPr9ZnTBtXTFV0MhFbuXoG6QR26aIrbYRY2S+DHoVdd/0atk16Xx/jTNjOZ5e1UwF+nk82MMKtuhH1QPC7sypwfoKe/6xbeA029n4RbmLRvUEyTadkK+28ifwSNno4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728455813; c=relaxed/simple; bh=Hc6DILxPQqL3l9UGsJ6qJ7xZnzZVgV80MBG0G0HvsjU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EvCktTUbshpxIrwNaoP8fm1NoeitzG9+lgNteDbzEGZRDrgcZlcUfP6vDlZEaXD2cfm/mKvlStFrArRVdCr0olkBEUgeCF3O0aUioF+yu/rumy1/OnRjs7Ya5VoIILb0Wdv630oGeXXjLepzIUtZJMz22fM0lUW0SZVaYRlhJpU= 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.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4XNjm15yY9zfcjG; Wed, 9 Oct 2024 14:34:25 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 7D2021800A0; Wed, 9 Oct 2024 14:36:49 +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; Wed, 9 Oct 2024 14:36:48 +0800 From: Zhang Zekun To: , , , , , , , CC: , Subject: [PATCH 2/4] clk: socfpga: Fix the use of uninitialized variable Date: Wed, 9 Oct 2024 14:32:27 +0800 Message-ID: <20241009063229.121258-3-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241009063229.121258-1-zhangzekun11@huawei.com> References: <20241009063229.121258-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: dggems705-chm.china.huawei.com (10.3.19.182) 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 Wed Oct 9 06:32:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 13827609 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 52A8A156960 for ; Wed, 9 Oct 2024 06:36:52 +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=1728455815; cv=none; b=m59cp5NmE/7+bH/37SraJj1Q1o4bom+zQ6SAnase6w41SzpDGGH/8/7mKNmCcTLdvSsm5TvpFWwW52Iixl70I7LxwEhLWPVaTVDW7pkpqXRVJGPmupsvrudJbmetJh1Mxh+QtNZKt2qaq/SAGWd4Gu3h02zc5QVs+ixSl9AD1uw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728455815; c=relaxed/simple; bh=PPIsEL5LF9mJFzMsAGTKPsIaw0O33KO5VwU5DgaVocU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GdS8WaCq1HCyDofi8Q/619Xcz9LLZe8sC3GqVwVdBNKa41Vo0TBoGzyn3EXFfQ+mExWQUzlr8F85S9BLh5HvkFfyN7yJn4VlsoLo4oNoqBSo91MHImiGo3LztDw5kUoAd0jn/P4Ur8UpK8LoOB04cZcEpyHR5hkox6qAE9IKoA0= 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.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4XNjm24nkbzfcjq; Wed, 9 Oct 2024 14:34:26 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 53F8114035F; Wed, 9 Oct 2024 14:36:50 +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; Wed, 9 Oct 2024 14:36:49 +0800 From: Zhang Zekun To: , , , , , , , CC: , Subject: [PATCH 3/4] clk: socfpga: arria10: Fix the use of uninitialized variable Date: Wed, 9 Oct 2024 14:32:28 +0800 Message-ID: <20241009063229.121258-4-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241009063229.121258-1-zhangzekun11@huawei.com> References: <20241009063229.121258-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: dggems705-chm.china.huawei.com (10.3.19.182) 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 Wed Oct 9 06:32:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 13827608 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 087FD15B0FE for ; Wed, 9 Oct 2024 06:36:52 +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=1728455814; cv=none; b=rPcecAvKctM9DOXiQGtctGwKCKAay1ftxK3RI8LELkUpm2PZC+ujZRWb2gDZmTQdOttNSAjNdpoI+zegTEXZUlah0EQpGEMMHEr9pAs4hrS2jRB4nJjPgr9wxOi2ZmXHBDMGN/7yFGO7KOPO52h7DNYjJ2D0LGDpUcw3W2hGTJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728455814; c=relaxed/simple; bh=8fd4Mcz9d/Dg4W389ZyHJuBMUL0wE2AvyQGU3KncKZU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=M4ZxwO5DGVdQf+b5XbC/mmaWHruib4lL046F9S2v7QE4lPggZq8MaBv/Tr/0anW4MHwkAr4VeR62WMBZdBCD4dUn7HkLBu1jsSTINiYi8VMXI7SFg+q6pOV9+ph99TzO5iL+pETmvJCNfDe6fIiNpOEpkSKvfCn+4a+WnJo7kqg= 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.162.254]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4XNjmW2F3zzpWXX; Wed, 9 Oct 2024 14:34:51 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 248921800DE; Wed, 9 Oct 2024 14:36:51 +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; Wed, 9 Oct 2024 14:36:50 +0800 From: Zhang Zekun To: , , , , , , , CC: , Subject: [PATCH 4/4] clk: socfpga: clk-pll: Fix the use of uninitialized variable Date: Wed, 9 Oct 2024 14:32:29 +0800 Message-ID: <20241009063229.121258-5-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241009063229.121258-1-zhangzekun11@huawei.com> References: <20241009063229.121258-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: dggems705-chm.china.huawei.com (10.3.19.182) 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))