From patchwork Mon Jan 2 08:20:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 38026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4065842wrt; Mon, 2 Jan 2023 00:24:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXvjCu8K4lAgKBJHCSj+v4REZMo6EGgqUp0PNhFwj6chapX0Okt0+2cGJXq5VCF1ezKZg4te X-Received: by 2002:a50:eb95:0:b0:48d:d5a3:1a40 with SMTP id y21-20020a50eb95000000b0048dd5a31a40mr3440938edr.38.1672647854223; Mon, 02 Jan 2023 00:24:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672647854; cv=none; d=google.com; s=arc-20160816; b=WqS+r92drOQywztnmHsp1P8H/lz5r2nxFQbXoDEMq9BjT3p0+3uYBz8JlsvMx2XlON Q4LD8GCk5g11uxnE3ukyEeyyuguxc3xzeDIr3YHGmH1wvlGHFzT1X/vOHew/kBrcBx8x e8mESEbZfcHfCrZv8zmE4KvZk7Hp7+dz2Fy+aU1SZj6IYLDisoTDemF7z5EMNoNZVgLB 9XLJgJXReZ9aeymanS9pAR0zZ/t5osDzx7YVQHIaN3c5wpJXvdRhM6n1MM9XqLQgjBX5 oy+aaRfVxudca7kF3IHCwhvr1mjZV6v9s1Q93K5kO/hvKPuJi3UXU1netdlaMzsAaKyC SSxw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=is3qNJJQlv75VO8zVD9j6Fa5IiqfTR1o+COwoVHzUoQ=; b=INW8ZFWtLLK25GfMXO0dJw4ozKczzubXhCbKY4LlqxVrKFXbn2a001UJyKQ1Ws5T9i UDDk++1KXH3RqMrWBn66MoswEQUEyA/A7w1t5bkhYf4IANsI3gUlvEaYz25zTfBA8QWb IwoEaULKUcMD1Irx8YTyweRtYDgJQDz5b5hVzEouijvE3f6jr7Xz287iV0z4GR0IGYDB DsSdlRBCCeFA5ZTvnFPHTKVKO9Giz3ue1wkc53u41l1v0BrltoDhMGuxUtJphUg32dow 5E1HkDRqhx8Y/Ohjj4KbHgKAx9y+vA3+QtrwHBDOhk1KtowJynOzz8rvXvPM+Ntyh2vw cc5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="o/zfZCVJ"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he17-20020a1709073d9100b0078c3197bf86si27549010ejc.533.2023.01.02.00.23.49; Mon, 02 Jan 2023 00:24:14 -0800 (PST) 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=@gmail.com header.s=20210112 header.b="o/zfZCVJ"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231708AbjABIVX (ORCPT + 99 others); Mon, 2 Jan 2023 03:21:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231653AbjABIVJ (ORCPT ); Mon, 2 Jan 2023 03:21:09 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2CFE112A; Mon, 2 Jan 2023 00:20:50 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id gv5-20020a17090b11c500b00223f01c73c3so25041224pjb.0; Mon, 02 Jan 2023 00:20:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=is3qNJJQlv75VO8zVD9j6Fa5IiqfTR1o+COwoVHzUoQ=; b=o/zfZCVJ3Ojd061xw+HJ9QBQxsYFmWaXST1juNnvNLMS5HCJpsAIXBLab1XYurg5kd q6B9JhWFpu+TPmt+Oc+AZbBCwHjoMX+0B3xqrhSUD/Lx5RB6+xQBDvLjJRwnb5+1on5l f0ZCH6wn2E/1BpDCOOEeSYaX68efUzh/eBaGf+yuBO8tpzpwffWYKiLsjqfHnu8geYfE fJea3SOt1KbWgaozcMC40biMwVw8cdtEYHPJmE+qi4FLwBuJUQAbYjjTSkTZCh7qdvTt Nuf9VNhpSpx3PnydlSfmDTb0UsWB9y6ezgaA6I2f5AjL8EY/suXPHvUKKIB4TnvVvFGT BPgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=is3qNJJQlv75VO8zVD9j6Fa5IiqfTR1o+COwoVHzUoQ=; b=v/A9VjsN0h3MGmOmxQqXUAyPiuiIdalQXwZU31jZGtuiuPVCs45HnvCquPOCJKmjKU wg9oPp+K9KnEeOD/mU7uZ8snBp9R/fU8Sz1MgCrgPX1Z+dcUA+6G9CYB2MEaIvKHC3kv 36pGfko/3ZRUAm42xF69xX9Lom7Qsvzlp1n3meNAz7oGLuOoiP3JiSOKjsMopLi43Yp1 KhOoa082geRSFXERkcamMBuM1aAyXAQ2aVGO5n8+LMsHuHQwKwkXrxfWRdy8+oJvnEPL kbKUPQTybghwy6GUFWtMxCRr/8Ly3+RrXJN0YNSle3EiBgOmT/MHHhxIzLTVRdl2VTv9 ndug== X-Gm-Message-State: AFqh2koKd1cTZ0rC/LSJHKgO3Qdd7MQKA9iS/AFgnLzlRBd99WpaocgZ bUk28PQ8VWtamRv+g0qKd8s= X-Received: by 2002:a17:90a:e516:b0:225:a520:e0a2 with SMTP id t22-20020a17090ae51600b00225a520e0a2mr41049329pjy.21.1672647649778; Mon, 02 Jan 2023 00:20:49 -0800 (PST) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id mq18-20020a17090b381200b001df264610c4sm23491898pjb.0.2023.01.02.00.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jan 2023 00:20:49 -0800 (PST) From: Miaoqian Lin To: Linus Walleij , Bartosz Golaszewski , Palmer Dabbelt , Paul Walmsley , Marc Zyngier , Yash Shah , Atish Patra , "Wesley W. Terpstra" , linux-gpio@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linmq006@gmail.com Subject: [PATCH] gpio: sifive: Fix refcount leak in sifive_gpio_probe Date: Mon, 2 Jan 2023 12:20:39 +0400 Message-Id: <20230102082039.3941790-1-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753898396631994694?= X-GMAIL-MSGID: =?utf-8?q?1753898396631994694?= of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 96868dce644d ("gpio/sifive: Add GPIO driver for SiFive SoCs") Signed-off-by: Miaoqian Lin --- drivers/gpio/gpio-sifive.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c index 238f3210970c..bc5660f61c57 100644 --- a/drivers/gpio/gpio-sifive.c +++ b/drivers/gpio/gpio-sifive.c @@ -215,6 +215,7 @@ static int sifive_gpio_probe(struct platform_device *pdev) return -ENODEV; } parent = irq_find_host(irq_parent); + of_node_put(irq_parent); if (!parent) { dev_err(dev, "no IRQ parent domain\n"); return -ENODEV;