Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1972339rwp; Thu, 13 Jul 2023 21:20:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlF504mie/izfQn6YSE/v+RqUUcZAZoDaYHx5cPF84SAWn3Kx14thWa7rgux8pS9YaUfo9Jj X-Received: by 2002:ac2:4f16:0:b0:4f8:43b8:c722 with SMTP id k22-20020ac24f16000000b004f843b8c722mr3761538lfr.67.1689308459465; Thu, 13 Jul 2023 21:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689308459; cv=none; d=google.com; s=arc-20160816; b=OfVxetSw1MzT6kwtozPqi5YOy1VNUJoVFl9xn96Tl2EyZIythR/MtmB/bb7/PVdlo2 jFGEunewl7rWaQmuql64M0++V5aKXWONPj32yvEFx0svd5SIP+DaGcmDceEI8GmbHDLJ Dvn5RUlDHpXuJzZlXL8ZJcm2ohbtR1kNQ5mH+LR+r10AvnUr1WHPh0zYuw1uC9lR9nrY u7KC+tCzD7qk01Z6tHRwiidOWrQyOlnryzNds3BpX3psvxBzToJE1umFLvPN1OnXFgYJ ZcHGfUckykzJjrhlyUKzvt2WnqxxDcLZC0Bl1rE8PqPYpESGrgxEMWPnA/BrE7B86HSA GjKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version :dkim-signature; bh=h5IB6mNORO9jxWGYFT6x8fzOs/v94jSYII7swaAf/AM=; fh=RJHsS08uO5Oz9gqaxXbjFxqQmIJvor/+KAA2BShvBoo=; b=ogJaXFHUbxqfO6g8cxjzCFB2P4pBFIrmj6qr3DCJlVvpuE2P322Sp3Jku6u78M9ZKf lT8v98aHedFwDoJg37gkux2sFbALiV0PeCmWP29ju6cmKRBTJg41S6gqKZMkmo1PPgWi i9moH/Iy3WdyYJBnbLvYb0HsxW7Jx1PP0JWEYrhI+5ZVmkqz1kZBkBZdXfclxAnkhSnt tmVhSK2j3DvaWuRBtUl6YXp5/BMT8D1xHYNa23BLGlkcGpdoedwmNB181cKlu2W2bFwh YuySPXFeFHQ3tVyekDQKlFkrBr4oDRcMMWUcc8857tyb5DT9FTxY5aJeEFHh/iZXNiCo vydg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (bad version) header.i=@208.org header.s=dkim header.b=V8ILV1Zw; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h2-20020a170906854200b00993ebae9927si7903055ejy.784.2023.07.13.21.20.34; Thu, 13 Jul 2023 21:20:59 -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=neutral (bad version) header.i=@208.org header.s=dkim header.b=V8ILV1Zw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234688AbjGNDnj (ORCPT + 99 others); Thu, 13 Jul 2023 23:43:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234448AbjGNDnf (ORCPT ); Thu, 13 Jul 2023 23:43:35 -0400 Received: from mail.208.org (unknown [183.242.55.162]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7349ACD for ; Thu, 13 Jul 2023 20:43:33 -0700 (PDT) Received: from mail.208.org (email.208.org [127.0.0.1]) by mail.208.org (Postfix) with ESMTP id 4R2HPs2GBlzBRSVN for ; Fri, 14 Jul 2023 11:43:29 +0800 (CST) Authentication-Results: mail.208.org (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=208.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=208.org; h= content-transfer-encoding:content-type:message-id:user-agent :references:in-reply-to:subject:to:from:date:mime-version; s= dkim; t=1689306209; x=1691898210; bh=SCgw1WCmhD6P4vsV5hq9Xr7uYP9 setPOegeKh2ZR/og=; b=V8ILV1ZwBGiiFJdC6+tlNJKDUEXN+p0iSjkZWWJGVNe f2ZE5EPEd3PO7w3iUZ58DyO/XJhrxUQXH/VHZ9DfBXKE+YFyMy20nx0eLMgz+TV4 5ozlOQm9TYt3A+drTcan7+G77wd1/ppS9h4VuQT/OmOJIh9dMhDd9daNPVdAG8Sn Bi/+2gT/wT2IvdfupJA7FHfbGhcH9F39b7ZguXpZMPEukOOEHKZwyZ/8/SX8bJI3 Y1S/ksrrY7xPGkytnkXrwYSpmGLWOAOoiBXCbcKs+jnR4t+kHrl0MgpHk/Zojj83 I+Gku1ArEU5Lhtuz0XHOHGn+e5TzckJgjVFbcI3zkIg== X-Virus-Scanned: amavisd-new at mail.208.org Received: from mail.208.org ([127.0.0.1]) by mail.208.org (mail.208.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id EI4ObUIrq84E for ; Fri, 14 Jul 2023 11:43:29 +0800 (CST) Received: from localhost (email.208.org [127.0.0.1]) by mail.208.org (Postfix) with ESMTPSA id 4R2HPs0696zBHXhN; Fri, 14 Jul 2023 11:43:28 +0800 (CST) MIME-Version: 1.0 Date: Fri, 14 Jul 2023 11:43:28 +0800 From: liubin001@208suo.com To: tglx@linutronix.de, maz@kernel.org Cc: linux-kernel@vger.kernel.org Subject: Fwd: [PATCH] irqchip:Use the "put_device" function to release the memory after calling the of_find_device_by_node function. In-Reply-To: References: User-Agent: Roundcube Webmail Message-ID: <66d48e6ce0db4f89737172a2963195a9@208suo.com> X-Sender: liubin001@208suo.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_BLOCKED,RDNS_NONE,SPF_HELO_FAIL,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Write the put_device function before return Signed-off-by: Liu Bin --- drivers/irqchip/irq-renesas-rzg2l.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c index 4bbfa2b0a4df..a9d75135ba24 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -325,35 +325,42 @@ static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent) pdev = of_find_device_by_node(node); if (!pdev) + put_device(pdev); return -ENODEV; parent_domain = irq_find_host(parent); if (!parent_domain) { dev_err(&pdev->dev, "cannot find parent domain\n"); + put_device(pdev); return -ENODEV; } priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) + put_device(pdev); return -ENOMEM; priv->base = devm_of_iomap(&pdev->dev, pdev->dev.of_node, 0, NULL); if (IS_ERR(priv->base)) + put_device(pdev); return PTR_ERR(priv->base); ret = rzg2l_irqc_parse_interrupts(priv, node); if (ret) { dev_err(&pdev->dev, "cannot parse interrupts: %d\n", ret); + put_device(pdev); return ret; } resetn = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(resetn)) + put_device(pdev); return PTR_ERR(resetn); ret = reset_control_deassert(resetn); if (ret) { dev_err(&pdev->dev, "failed to deassert resetn pin, %d\n", ret); + put_device(pdev); return ret; } @@ -374,7 +381,7 @@ static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent) ret = -ENOMEM; goto pm_put; } - + put_device(pdev); return 0; pm_put: @@ -382,6 +389,7 @@ static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent) pm_disable: pm_runtime_disable(&pdev->dev); reset_control_assert(resetn); + put_device(pdev); return ret; }