From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 576E7C43464 for ; Fri, 18 Sep 2020 13:27:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0539223719 for ; Fri, 18 Sep 2020 13:27:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726950AbgIRN1K (ORCPT ); Fri, 18 Sep 2020 09:27:10 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:38498 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726683AbgIRN1G (ORCPT ); Fri, 18 Sep 2020 09:27:06 -0400 X-Greylist: delayed 904 seconds by postgrey-1.27 at vger.kernel.org; Fri, 18 Sep 2020 09:27:05 EDT Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kJGBC-0001vI-93; Fri, 18 Sep 2020 13:11:58 +0000 From: Colin King To: Mark Brown , Greg Kroah-Hartman , "Rafael J . Wysocki" , Charles Keepax Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] regmap: fix return of unintialized value in variable ret Date: Fri, 18 Sep 2020 14:11:58 +0100 Message-Id: <20200918131158.24083-1-colin.king@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King 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 --- 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