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 B22EF63B8 for ; Mon, 20 Feb 2023 13:40:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D54EC433D2; Mon, 20 Feb 2023 13:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1676900453; bh=WFgLCuryaOcR9O+fGLnRQ083XnmusI91EmrDq6UbRgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ALOMW7Fzf26eougAZA3JVmzw8yEtoBUDX+ujYHX3ErI5jqBcXktS9qOaaMVnHlTOD fQMMKwjzkt5cyXaXTAl+tF8HHkEj59eAIoLCn3ikpMOOQXjnrnBQK/OjNY/CV3aR3r dGCM8vLUs9BYLPFfEyk1m1DYRv2/wpM/h/DQPXls= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiongfeng Wang , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 4.19 31/89] iio: adc: berlin2-adc: Add missing of_node_put() in error path Date: Mon, 20 Feb 2023 14:35:30 +0100 Message-Id: <20230220133554.255012068@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230220133553.066768704@linuxfoundation.org> References: <20230220133553.066768704@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: Xiongfeng Wang commit cbd3a0153cd18a2cbef6bf3cf31bb406c3fc9f55 upstream. of_get_parent() will return a device_node pointer with refcount incremented. We need to use of_node_put() on it when done. Add the missing of_node_put() in the error path of berlin2_adc_probe(); Fixes: 70f1937911ca ("iio: adc: add support for Berlin") Signed-off-by: Xiongfeng Wang Link: https://lore.kernel.org/r/20221129020316.191731-1-wangxiongfeng2@huawei.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/berlin2-adc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/iio/adc/berlin2-adc.c +++ b/drivers/iio/adc/berlin2-adc.c @@ -289,8 +289,10 @@ static int berlin2_adc_probe(struct plat int ret; indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv)); - if (!indio_dev) + if (!indio_dev) { + of_node_put(parent_np); return -ENOMEM; + } priv = iio_priv(indio_dev); platform_set_drvdata(pdev, indio_dev);