Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2652803pxj; Mon, 31 May 2021 07:27:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtX6uBAbNDpDV1nxicVPqVCQ2XK0/DSbk9tMOcCj+o28i2+kS9Z897c3iU53y77cPjlzWZ X-Received: by 2002:a92:d283:: with SMTP id p3mr11411987ilp.170.1622471243008; Mon, 31 May 2021 07:27:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622471243; cv=none; d=google.com; s=arc-20160816; b=ZL0AxY8YuDzyK36isJNYJSGtUiMNummhjoWcDLrnd8p648Q0Q0EYPAIb0JWLX0Ie6U Yi7vm28V/gIpvif7LHz/3nGxG0uP+Uy9vO/CZGVqUpoYAm5aCJRojFqunx+tqPsmyars iVCtHIRCUr0cF5Hjp2XgNkDysWSuHUhP/5oMvqnFlVd67jVV1qPycxTecdFVnSzyYV6A 6geAujHoN0dSnjF1ChEYoVdfrm1Cgpf/EDJoHCBgUiFkTYkOk0wORCXHFfosL4Qqkxyq mHE4TDwOesLYzazSkNEzu4Q7IPexymZ0Hz1ZfeEk7EtfQxkmWoqSlVQaoe0gUa85bT2s ETEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0gNQkuY9puC7DR6+txXFJ23M/t8BXrYeceG1R0afdHY=; b=HUGEXbEEt5z3LzFOxWvN3b67N09fYf5w3f6oaw3TqKSAcwmgvHRnrO9/DJUavJGk0s ULC1pC0Hh3hazKJUWPXfN+C1wbKmXmjSM3MZBFtDstuYHqNDNhOxHlMBft26E+ff2L2m PoPQsAGR3UyynySGX/lBnlyKwfbK1H7iUXDZTPLENCQOAjtFRB0sZUsNrpJpLoElFRMa kS+m2M+7ZYN0bFGHc5wFlejHjtm6h7nVU7wDQt91ej42rDx6obkIs8Y1/BtKaVpuoOsV 6ElvMp5cTZly+PGVPNSrE1Sv/IW/f+3pglSv1HoflXSDs3UL4cGC0ic/vgko7PghhXll e+rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I57t2iGm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w31si13907423jal.77.2021.05.31.07.27.09; Mon, 31 May 2021 07:27:22 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I57t2iGm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233889AbhEaO17 (ORCPT + 99 others); Mon, 31 May 2021 10:27:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:55338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbhEaNvq (ORCPT ); Mon, 31 May 2021 09:51:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B7376617C9; Mon, 31 May 2021 13:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467954; bh=CnVjX5vT2irg3av9FDImDH3Pys1rwVPHHG4quadwNt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I57t2iGmjYG6yZDOjDwNcYO9+nj6Fn0sRBMn9/DeLyolm51ktn9uAzNAUN09866Kb hQkjKAZ0jRRa0MrbSIjJhL5kpC2rq+Irx3/R01p/IWDK+vEDxcDhtZ5epfuil6CE8t xiRASqAgahI8MfPdiUqBDboeUQNrsX0dN5Uth4qo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandru Tachici , Andy Shevchenko , Alexandru Ardelean , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.10 062/252] iio: dac: ad5770r: Put fwnode in error case during ->probe() Date: Mon, 31 May 2021 15:12:07 +0200 Message-Id: <20210531130700.088389541@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko commit 98b7b0ca0828907dbb706387c11356a45463e2ea upstream. device_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. Fixes: cbbb819837f6 ("iio: dac: ad5770r: Add AD5770R support") Cc: Alexandru Tachici Signed-off-by: Andy Shevchenko Reviewed-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20210510095649.3302835-1-andy.shevchenko@gmail.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/dac/ad5770r.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) --- a/drivers/iio/dac/ad5770r.c +++ b/drivers/iio/dac/ad5770r.c @@ -524,23 +524,29 @@ static int ad5770r_channel_config(struct device_for_each_child_node(&st->spi->dev, child) { ret = fwnode_property_read_u32(child, "num", &num); if (ret) - return ret; - if (num >= AD5770R_MAX_CHANNELS) - return -EINVAL; + goto err_child_out; + if (num >= AD5770R_MAX_CHANNELS) { + ret = -EINVAL; + goto err_child_out; + } ret = fwnode_property_read_u32_array(child, "adi,range-microamp", tmp, 2); if (ret) - return ret; + goto err_child_out; min = tmp[0] / 1000; max = tmp[1] / 1000; ret = ad5770r_store_output_range(st, min, max, num); if (ret) - return ret; + goto err_child_out; } + return 0; + +err_child_out: + fwnode_handle_put(child); return ret; }