Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp761493rwd; Thu, 25 May 2023 03:40:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7gpw4257XmVFeWBJVIHDEVbBbSr3jMyZDQjMfNq9FPEmwkPQlWDvZt7K7Bl4De4MTHVpTo X-Received: by 2002:a05:6a00:194f:b0:647:e45f:1a49 with SMTP id s15-20020a056a00194f00b00647e45f1a49mr8068123pfk.4.1685011210490; Thu, 25 May 2023 03:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685011210; cv=none; d=google.com; s=arc-20160816; b=DmM0HxVkcavDTmrWP+1LEApclaFvjJ/thnfOesJSQdEcceGy7h8Xe90p2cHAsXOeuU 15lJ8+89P+Hg7cr/MBytfutNw0bl9x/ST+0gribOzUDQb/aimbRYFI8RuwhDFwoSGj0j 4nBdtY7emEtc3pizQ8oRE7seiBwuVmb9q+YJg6OoEDxkwMpmfoleGU3Rnjwt7XsgnZS1 BXmc1PvGWx+/hVQrCjnPWMmzemLm/F4lWdTRMfTtf1EG6PqFRJHpLy57sRdGXaG/Xys3 Z7ZFmGUhfDVoUF9JjC/lMdKhAoXEA4t3bqI8IsPEdhA7RxxCgNDE8PtyXO/ll0aqOy4t y0xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QAanmz39A1+K8oPhZMqQOCM18wzNOKYeJE/zKly0koM=; b=S6KcrezhA7VVPAfMWufhlGa0JVSnYOXnoQGk1wLVFb1kIwyBi6CJEcvx0NtjX42htw dRFGY0VoctKhQeCk0BU289uj8cNBUjaqvezbQJJy7HZuE+NENeQLE5mx6U9CL82RW2Wd FwFk/LXtb4nZl3lf0tOOYUzxIaUw15w9s0GNs8Fum2xspQGcyNfVhjs/nEumCaUsogHQ ulBsz6bxhqpj8LzDjwuH026DLYLDhUojJo6rMeBOL4kDK158SxkFqggKIPx9ymF9WNl/ 713+4zTbzwUqq6/J2eJUta/qTRg2ZMBpShlo6a/8hwEqi40GHh16OeXlUHIRwDKjAa1d YsJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UVtB191w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r27-20020aa7989b000000b00625c6092a12si1203619pfl.215.2023.05.25.03.39.56; Thu, 25 May 2023 03:40:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UVtB191w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233677AbjEYKVj (ORCPT + 99 others); Thu, 25 May 2023 06:21:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240891AbjEYKVR (ORCPT ); Thu, 25 May 2023 06:21:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A81EF1AB; Thu, 25 May 2023 03:20:43 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 33E7D64484; Thu, 25 May 2023 10:20:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 032F2C4339B; Thu, 25 May 2023 10:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685010042; bh=iOTbN+LF/85xc4OrL5mazWp8f/WUdpjoDOfNOUiMOEw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UVtB191wNaVJ0vqiy3mm2Urn38kr9zcc/cKPX4ZSBt9CeL5MFb8CcY1B0WSVvsjWD dwKe78z+1YdMxtlcg6qho2enSYHXcyIBbXhJcun91q8EMvKvrxqb/KlsMaDzg34a5w BnrTi501mplvlRbrROuu4qwmnh47myRCkaT0M5n4PZ7zWXS/U7Xpi2XjNGBIOvnbFl PceCf/2XyoSlHgEvSWs3K1OdpSsY8IdIhXvhbuCDKNBOHw5V58wuxzY/DJBVG8jvZs G+IrJ7sSSRTQzNPr66yIHtvK4a+51nUM3S8hg4QVvkU6n9JkbhUjol0HuOqMhqYsLz z2SThUt28eEKw== Date: Thu, 25 May 2023 11:20:36 +0100 From: Lee Jones To: luhongfei Cc: Pavel Machek , Thierry Reding , Anjelique Melendez , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Conor Dooley , Dmitry Baryshkov , Bjorn Andersson , luhongfei <11117923@bbktel.com>, "open list:LED SUBSYSTEM" , open list , opensource.kernel@vivo.com Subject: Re: [PATCH] led: qcom-lpg: Fix bugs in lpg_add_led & lpg_probe Message-ID: <20230525102036.GB9691@google.com> References: <20230515082622.24551-1-luhongfei@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230515082622.24551-1-luhongfei@vivo.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Please improve the subject line. Maybe: "Fix resource leaks in for_each_available_child_of_node() loops" On Mon, 15 May 2023, luhongfei wrote: > for_each_available_child_of_node in lpg_probe and lpg_add_led need > to execute of_node_put before return. this patch could fix this bug. "Ensure child node references are decremented properly in the error path." > Signed-off-by: luhongfei Please use your full name. > --- > drivers/leds/rgb/leds-qcom-lpg.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > mode change 100644 => 100755 drivers/leds/rgb/leds-qcom-lpg.c > > diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c > index 55a037234df1..0e8ff36c4bf7 > --- a/drivers/leds/rgb/leds-qcom-lpg.c > +++ b/drivers/leds/rgb/leds-qcom-lpg.c > @@ -1173,8 +1173,10 @@ static int lpg_add_led(struct lpg *lpg, struct device_node *np) > i = 0; > for_each_available_child_of_node(np, child) { > ret = lpg_parse_channel(lpg, child, &led->channels[i]); > - if (ret < 0) > + if (ret < 0) { > + of_node_put(child); > return ret; > + } > > info[i].color_index = led->channels[i]->color; > info[i].intensity = 0; > @@ -1352,8 +1354,10 @@ static int lpg_probe(struct platform_device *pdev) > > for_each_available_child_of_node(pdev->dev.of_node, np) { > ret = lpg_add_led(lpg, np); > - if (ret) > + if (ret) { > + of_node_put(np); > return ret; > + } > } Code is fine. -- Lee Jones [李琼斯]