[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1420731061-5029-1-git-send-email-colin.king@canonical.com>
Date: Thu, 8 Jan 2015 15:31:01 +0000
From: Colin King <colin.king@...onical.com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
linux-pm@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] PM / clock_ops: initialize ret to avoid garbage being returned
From: Colin Ian King <colin.king@...onical.com>
cppcheck detected an unitialised ret:
[drivers/base/power/clock_ops.c:53]: (error) Uninitialized variable: ret
ret is only assigned if ce->status < PCE_STATUS_ERROR, if this is false
then __pm_clk_enable returns whatever garbage ret picks up from the stack.
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/base/power/clock_ops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index d626576..5bd283d 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -39,7 +39,7 @@ struct pm_clock_entry {
*/
static inline int __pm_clk_enable(struct device *dev, struct pm_clock_entry *ce)
{
- int ret;
+ int ret = 0;
if (ce->status < PCE_STATUS_ERROR) {
ret = clk_enable(ce->clk);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists