From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8128C63B8 for ; Mon, 20 Feb 2023 13:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D434CC433D2; Mon, 20 Feb 2023 13:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1676901085; bh=cPrTXOixXNlXzQjvmoHKk3/430NvEe6M0hbeedBPQPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZr9YrmZt9YaNR5cfxcMjzZ0WCZNaQSI5q/Y1zX+RCpupOuXZc6VGlgaimwbKmXNc DamtTdRdpPBc5GnLP5ef8SR7YrNoBhAT4YAhT2U1CNckPvYKDG2pBj1Y54tPW6kmM3 QMtYvHgu8T4rHqfD6phSFxv3L2RtyEXRC13Tiykc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, kernel test robot , Dan Carpenter , "Russell King (Oracle)" , Srinivas Kandagatla , Sasha Levin Subject: [PATCH 5.15 23/83] nvmem: core: fix return value Date: Mon, 20 Feb 2023 14:35:56 +0100 Message-Id: <20230220133554.506411228@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230220133553.669025851@linuxfoundation.org> References: <20230220133553.669025851@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Russell King (Oracle) [ Upstream commit 0c4862b1c1465e473bc961a02765490578bf5c20 ] 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. Fixes: 560181d3ace6 ("nvmem: core: fix cleanup after dev_set_name()") Cc: stable@vger.kernel.org Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Russell King (Oracle) Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20230127104015.23839-10-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/nvmem/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 6a74e38746057..47c1487dcf8cc 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -779,6 +779,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) GPIOD_OUT_HIGH); if (IS_ERR(nvmem->wp_gpio)) { rval = PTR_ERR(nvmem->wp_gpio); + nvmem->wp_gpio = NULL; goto err_put_device; } -- 2.39.0