From patchwork Tue Jan 10 16:48:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13095360 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F0DBC54EBC for ; Tue, 10 Jan 2023 16:50:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=xtXuiZB7pINMTMQMVY35kEprgHdMD/n1CTEVG/DdBS0=; b=YSIwLMn9mpyDn5 XG3PY9b3NQaZi7/G/NBn8N7xfFP+jXqUi09h5RmozVxYItFykDx9fu5HeyYBIKvqGl0OVyFLc6AMx bT++8fqACZSet1neqzZuLo587GdjMpy14K1EIlSf+nieWOvDc9lF4+3AWQExkZ3kLBP/XuYQuhAjd Ypbcjnv4WGWw1/3HGxncq/vwrt4kHxmLt2qJbFcS57iNSVmyK7qP5wMPhJjLfPP0s082kAYaNWi/c OEB2FVVPwq39d2Ps8i8H1ul52lu9Zkk3qbd23CBX1XIkgwN3QtGxQ9HrnJKzR/SytMyU2beuLAbiD iyl7dueQpOyPi92tG59A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFHo0-007rLf-Ry; Tue, 10 Jan 2023 16:48:57 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFHny-007rJp-BR for linux-arm-kernel@lists.infradead.org; Tue, 10 Jan 2023 16:48:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VjNU35/mRqNvoqytQvyBwxKCGgTYR8gN2Ys6Sj3vKTA=; b=nEwkBpQ0K+3YEZQaaXdXImhMJu VLG0H/mikxKnmYZJLnLoLwI6+F8tns7YAXPrXi7tBs/tdOqmtmpHg6oznQwQWYQVnejoR85PT5mFy nM7bxs5FgG0OrXMlCvu/OgzdNjr8GtBJULveaOSYH4+3BksOuUUjKNHTVn8b7Bh1RW4AVx6S47Hnx A43q93n8OR2jF14FlQax5v8ENB0ALxIkTo8YxZNpqbOvZIK7+/2X06xFwvkvdt5MKPRvvk1z01V/F a5a4802DGV1wy3xX6g0bkon/ZvWzZUadqaGFm20K8i4Pf6/xv080sqeeB742+NDdORRFeQN5SW4hQ 8NiiY2uQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:44132 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pFHnt-0004Bx-FE; Tue, 10 Jan 2023 16:48:49 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pFHns-005syu-Df; Tue, 10 Jan 2023 16:48:48 +0000 From: "Russell King (Oracle)" To: Srinivas Kandagatla Cc: linux-arm-kernel@lists.infradead.org Subject: [PATCH] nvmem: core: fix return value MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 10 Jan 2023 16:48:48 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230110_084854_412181_9C5F118C X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Dan Carpenter points out that the return code was not set in commit 60c8b4aebd8e ("nvmem: core: fix cleanup after dev_set_name()"), but this is not the only issue - we also need to zero wp_gpio to prevent gpiod_put() being called on an error value. Reported-by: kernel test robot Reported-by: Dan Carpenter Fixes: 60c8b4aebd8e ("nvmem: core: fix cleanup after dev_set_name()") Signed-off-by: Russell King (Oracle) --- drivers/nvmem/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 082cda7ac199..1ee2e9255f7b 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -781,8 +781,11 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) if (!config->ignore_wp) nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp", GPIOD_OUT_HIGH); - if (IS_ERR(nvmem->wp_gpio)) + if (IS_ERR(nvmem->wp_gpio)) { + rval = PTR_ERR(nvmem->wp_gpio); + nvmem->wp_gpio = NULL; goto err_put_device; + } kref_init(&nvmem->refcnt); INIT_LIST_HEAD(&nvmem->cells);