[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200918131158.24083-1-colin.king@canonical.com>
Date: Fri, 18 Sep 2020 14:11:58 +0100
From: Colin King <colin.king@...onical.com>
To: Mark Brown <broonie@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Charles Keepax <ckeepax@...nsource.cirrus.com>
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] regmap: fix return of unintialized value in variable ret
From: Colin Ian King <colin.king@...onical.com>
A recent commit removed the intialization of ret and now the !config
error return path returns a bogus uninitialized value in ret. Fix
this by explicitly setting ret to -EINVAL for this error exit path.
Addresses-Coverity: ("Uninitialized scalar value")
Fixes: 94cc89eb8fa5 ("regmap: debugfs: Fix handling of name string for debugfs init delays")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/base/regmap/regmap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index d0f7cc574ff3..bd385b82f30b 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -710,8 +710,10 @@ struct regmap *__regmap_init(struct device *dev,
int i, j;
int ret;
- if (!config)
+ if (!config) {
+ ret = -EINVAL;
goto err;
+ }
map = kzalloc(sizeof(*map), GFP_KERNEL);
if (map == NULL) {
--
2.27.0
Powered by blists - more mailing lists