From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============9054032873424012335==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] regulator: qcom_smd: fix for_each_child.cocci warnings Date: Sat, 15 Jan 2022 12:42:31 +0800 Message-ID: <20220115044231.GA47167@a63126d9b96c> In-Reply-To: <202201151222.2xt6Lcxp-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============9054032873424012335== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Konrad Dybcio CC: Mark Brown CC: Andy Gross CC: Bjorn Andersson CC: Liam Girdwood CC: linux-arm-msm(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/regulator/qcom_smd-regulator.c:1318:1-33: WARNING: Function "for_ea= ch_available_child_of_node" should have of_node_put() before return around = line 1321. Semantic patch information: False positives can be due to function calls within the for_each loop that may encapsulate an of_node_put. Generated by: scripts/coccinelle/iterators/for_each_child.cocci Fixes: 14e2976fbabd ("regulator: qcom_smd: Align probe function with rpmh-r= egulator") CC: Konrad Dybcio Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: 112450df61b7373529b0fe4c122ad13b89d80a8a commit: 14e2976fbabdacb01335d7f91eeebbc89c67ddb1 regulator: qcom_smd: Align= probe function with rpmh-regulator :::::: branch date: 13 hours ago :::::: commit date: 9 days ago Please take the patch only if it's a positive warning. Thanks! qcom_smd-regulator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c @@ -1317,8 +1317,10 @@ static int rpm_reg_probe(struct platform = for_each_available_child_of_node(dev->of_node, node) { vreg =3D devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); - if (!vreg) + if (!vreg) { + of_node_put(node); return -ENOMEM; + } = ret =3D rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data); =20 --===============9054032873424012335==--