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 0E3FC63B8 for ; Mon, 20 Feb 2023 13:46:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 655EFC433D2; Mon, 20 Feb 2023 13:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1676900789; bh=WFgLCuryaOcR9O+fGLnRQ083XnmusI91EmrDq6UbRgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lcIRUd/m9siPGQCEFcH+5Odd7aVI0YzNlrih8UKRp2A+04UCXEGp3mJKpQ7gGnPlD e1bGPIAyOG380ed4QAPKPObGBNH+VTSkH1EdUJZN874HD4BENtXxwuvgpek6g84noD LmWjN/LZX1f8hZFpUcJ2Y9lAot9FdIVdWBhUk4xs= 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 5.4 041/156] iio: adc: berlin2-adc: Add missing of_node_put() in error path Date: Mon, 20 Feb 2023 14:34:45 +0100 Message-Id: <20230220133604.097723301@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230220133602.515342638@linuxfoundation.org> References: <20230220133602.515342638@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);