]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cpufreq: imx6q: fix possible object reference leak
authorWen Yang <wen.yang99@zte.com.cn>
Mon, 1 Apr 2019 01:37:49 +0000 (09:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:45:09 +0000 (06:45 -0700)
[ Upstream commit ddb64c5db3cc8fb9c1242214d5798b2c2865681c ]

The call to of_node_get returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
./drivers/cpufreq/imx6q-cpufreq.c:391:4-10: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 348, but without a corresponding object release within this function.
./drivers/cpufreq/imx6q-cpufreq.c:395:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 348, but without a corresponding object release within this function.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/cpufreq/imx6q-cpufreq.c

index 9fedf627e000d5338b3c97b1f0760c8b67dbb28d..3ee55aee5d71ac07a3d5c709c8c788cdb3497b09 100644 (file)
@@ -407,11 +407,11 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
                ret = imx6ul_opp_check_speed_grading(cpu_dev);
                if (ret) {
                        if (ret == -EPROBE_DEFER)
-                               return ret;
+                               goto put_node;
 
                        dev_err(cpu_dev, "failed to read ocotp: %d\n",
                                ret);
-                       return ret;
+                       goto put_node;
                }
        } else {
                imx6q_opp_check_speed_grading(cpu_dev);