Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1747434pxk; Sat, 26 Sep 2020 03:48:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBKu0Zfxxx6g1qu8FWie5kpVYUJ8th0qDCJnhXmmfhVZZZySbpKbYl/WsttAORR6rAPAj0 X-Received: by 2002:a17:907:20a3:: with SMTP id pw3mr7212267ejb.314.1601117338915; Sat, 26 Sep 2020 03:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601117338; cv=none; d=google.com; s=arc-20160816; b=XSqMRAGvMtf0crceMC3sWi5+kEmhro9StaDpDUEdHQVcTVyGlrGQP3qKovWqqeNMGA qPOPjoP/znKKNIdK6b3HzqAF7sYj7umAOMTzNMBtctoZQ6BAR8mLJ4mYAMe8i/bnL2uo gcY7cVHxTfLKh9EbmiNIDS5GUJkXxmwWi3CBbPomCr3zYBDry4gop333qrdSVCZ01GcV QRSdTfM33r5TMns7GxnzI74DbY/Rr1FLZwuma/o0HTfXh03X7TZuSFsS653cYQtyjwBy cVKbCvDTd9yqMINKYqX/+L2GH+EISjSupscXyP/eaHlqQbu74xljSfHRwsyEgdKGdAL0 MPYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=Huufu/y8ZjzoM7Jd+SiJ/6S4lRSemaWUxAhIWxk+VPs=; b=VwoNi//96rhzI7yruI8hNve6ZXzYyAijkixmCUwpjdP/77AOYbqEQyjM4QbFJPl3is dRhygsG98lexLupiNnyjd4waS9VQWlsmh0KZf4Ad7AE3/iFXFRoA2xZkrQ2E8NE8v5LH lBl1Hn/Bhg8yetrer1lTPB2DRgHnpA+/AJZX6CvnstnvRZqeHzMa7EVrTkQfVoREMA5Z p+tPVSUkRXfinVIx9CNcq9nIQwrg8k3okVYIwPwTVoHjL9/ctm21Kj00WMI0/W5lTOfZ Du43q0GO8amkg37eCtresweLH+YgO1HzaFifK1W9WsLGDt57/PD/F//UhasCjyEYSloy lakQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z23si3790811edx.215.2020.09.26.03.48.35; Sat, 26 Sep 2020 03:48:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbgIZKr3 (ORCPT + 99 others); Sat, 26 Sep 2020 06:47:29 -0400 Received: from agrajag.zerfleddert.de ([88.198.237.222]:53524 "EHLO agrajag.zerfleddert.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726409AbgIZKp0 (ORCPT ); Sat, 26 Sep 2020 06:45:26 -0400 Received: by agrajag.zerfleddert.de (Postfix, from userid 1000) id A18785B20677; Sat, 26 Sep 2020 12:45:15 +0200 (CEST) Date: Sat, 26 Sep 2020 12:45:15 +0200 From: Tobias Jordan To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Marek Vasut , Jonathan Cameron , Lars-Peter Clausen , Peter Meerwald-Stadler Subject: [PATCH] iio: adc: gyroadc: fix leak of device node iterator Message-ID: <20200926104515.GA12079@agrajag.zerfleddert.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add missing of_node_put calls for the error paths of the for_each_child_of_node loop in rcar_gyroadc_parse_subdevs. Thought about adding an "goto err_of_node_put" instead, but as the error paths are quite divergent, I'm not sure if that wouldn't complicate things. Fixes: 059c53b32329 ("iio: adc: Add Renesas GyroADC driver") Signed-off-by: Tobias Jordan --- drivers/iio/adc/rcar-gyroadc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c index dcaefc108ff6..3746b0276b80 100644 --- a/drivers/iio/adc/rcar-gyroadc.c +++ b/drivers/iio/adc/rcar-gyroadc.c @@ -357,6 +357,7 @@ static int rcar_gyroadc_parse_subdevs(struct iio_dev *indio_dev) num_channels = ARRAY_SIZE(rcar_gyroadc_iio_channels_3); break; default: + of_node_put(child); return -EINVAL; } @@ -374,6 +375,7 @@ static int rcar_gyroadc_parse_subdevs(struct iio_dev *indio_dev) dev_err(dev, "Failed to get child reg property of ADC \"%pOFn\".\n", child); + of_node_put(child); return ret; } @@ -382,6 +384,7 @@ static int rcar_gyroadc_parse_subdevs(struct iio_dev *indio_dev) dev_err(dev, "Only %i channels supported with %pOFn, but reg = <%i>.\n", num_channels, child, reg); + of_node_put(child); return -EINVAL; } } @@ -391,6 +394,7 @@ static int rcar_gyroadc_parse_subdevs(struct iio_dev *indio_dev) dev_err(dev, "Channel %i uses different ADC mode than the rest.\n", reg); + of_node_put(child); return -EINVAL; } @@ -401,6 +405,7 @@ static int rcar_gyroadc_parse_subdevs(struct iio_dev *indio_dev) if (IS_ERR(vref)) { dev_dbg(dev, "Channel %i 'vref' supply not connected.\n", reg); + of_node_put(child); return PTR_ERR(vref); } -- 2.20.1