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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F0F2C636CC for ; Tue, 7 Feb 2023 13:15:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232351AbjBGNPI (ORCPT ); Tue, 7 Feb 2023 08:15:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232602AbjBGNOh (ORCPT ); Tue, 7 Feb 2023 08:14:37 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42E5E1026F for ; Tue, 7 Feb 2023 05:14:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7D26ECE1DAD for ; Tue, 7 Feb 2023 13:13:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7520BC433EF; Tue, 7 Feb 2023 13:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675775622; bh=WFgLCuryaOcR9O+fGLnRQ083XnmusI91EmrDq6UbRgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fgRTmsT2uHdkbLJ18DlKZLNjsl5zFri8mbhLNlVc3gBoLlgR9To6ZAzgykX1oUXF6 jnSWSlfN5kEuMgR9jtzWKL2Sc7rDiJ/RG/p0x4W+nIuppGpXS7sorJzSdiv6hiSr85 GPuohLJp5X9pykAETR3mZ69sxWiXbLupZH2+MZ5U= 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.15 075/120] iio: adc: berlin2-adc: Add missing of_node_put() in error path Date: Tue, 7 Feb 2023 13:57:26 +0100 Message-Id: <20230207125621.946338640@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230207125618.699726054@linuxfoundation.org> References: <20230207125618.699726054@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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);