Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1927838ioo; Mon, 23 May 2022 06:29:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqlA9BJvPm1zYu142a2q59niw3a3BCMg0ovv27vMbjxbTbqqgOWSMQrcjeh5URO+2uyySu X-Received: by 2002:a17:90b:1d0b:b0:1df:b3dc:5140 with SMTP id on11-20020a17090b1d0b00b001dfb3dc5140mr26359378pjb.225.1653312570944; Mon, 23 May 2022 06:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653312570; cv=none; d=google.com; s=arc-20160816; b=Y3MWshBgMwzAlJdgPIpqRE6225mXSqfYQDgp+EMjaSI27D0u1xRIoKxs682+0K7rlm 8s5Cg+7nNrw3lgeioAlkLaUsDUCMx30GJrxnf171Pec0fBp6ovy6jKAGO2J08Symyk/h 9lMEEr69CxLSgtzIAFD7Aqly6eMH3rtSnyosjL5vaz9dXmsgrKJJTDfJNAW9PHHH0LI5 jen9T8rsKRgROF7Od7E6URtQd2nHh7ewlAirkPQffdfZX2ku2izNrW7d52Evh4BwQfGU 5DRVy6/JEpExeQngL77gjMV7ld+UK6Rm/naJ5t5HepuHX34HqJIZ/DG5whHTnz9cOtFV OhAg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=g3Xmcd2Y2Dn5OVJXvRXtuTzqBjVShFADp+T09k2yWQ4=; b=DN5x0Tj4voj74/qzwLqWeLupfOCsDJJmtKXUEMO6iHvJUUNZnHa5Xga4z4L2J84Wm4 jKNkLXri5UiKRwPUdLozDivTbpzwd/LB0afa3BrQXhHJNMd3B084bec7kad25Y5Yyw7m MXKCJ3rNjLvLerIzptr8ZIiez041cfycvmzcISmKWkX8jYPTY3qwKcIbCxHwJlw8iTNS gWfTVaXBj48VhaEDHLR/7krk2KwT87a+Abfk0yxVFmppZfSgw3yjUIDwO1xazb+OCuf4 b2lGwUeSEE0i87+laj3chpuoJGe2YrlYHABlwseZ6S+8pzuguqYDVxgxPv3uoZJoyHKy UI2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q19-20020a170902bd9300b001615a62cf93si9331022pls.544.2022.05.23.06.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 06:29:30 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B76113EB81; Mon, 23 May 2022 06:28:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236355AbiEWN2J (ORCPT + 99 others); Mon, 23 May 2022 09:28:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236308AbiEWN2B (ORCPT ); Mon, 23 May 2022 09:28:01 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 248783AA7A for ; Mon, 23 May 2022 06:27:36 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 640701063; Mon, 23 May 2022 06:27:36 -0700 (PDT) Received: from bogus (unknown [10.57.66.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C2F993F70D; Mon, 23 May 2022 06:27:34 -0700 (PDT) Date: Mon, 23 May 2022 14:27:28 +0100 From: Sudeep Holla To: cgel.zte@gmail.com Cc: cristian.marussi@arm.com, linux-arm-kernel@lists.infradead.org, Sudeep Holla , linux-kernel@vger.kernel.org, Minghao Chi , Zeal Robot Subject: Re: [PATCH] firmware: arm_scmi: Avoid leak OF node on error Message-ID: <20220523132728.lfk6mskynqk636m4@bogus> References: <20220523111116.2898-1-chi.minghao@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220523111116.2898-1-chi.minghao@zte.com.cn> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Mon, May 23, 2022 at 11:11:16AM +0000, cgel.zte@gmail.com wrote: > From: Minghao Chi > > The OF node should be put before returning error in smc_chan_available(), > otherwise node's refcount will be leaked. > > Reported-by: Zeal Robot > Signed-off-by: Minghao Chi > --- > drivers/firmware/arm_scmi/smc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c > index 745acfdd0b3d..43018be70edc 100644 > --- a/drivers/firmware/arm_scmi/smc.c > +++ b/drivers/firmware/arm_scmi/smc.c > @@ -55,10 +55,10 @@ static irqreturn_t smc_msg_done_isr(int irq, void *data) > static bool smc_chan_available(struct device *dev, int idx) > { > struct device_node *np = of_parse_phandle(dev->of_node, "shmem", 0); > + of_node_put(np); While this may work as of_node_put handles NULL as argument, what is the point of unnecessary of_node_put(NULL) here ? -- Regards, Sudeep