Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp636866iog; Mon, 13 Jun 2022 09:36:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1syJhNhsnjdNSvs9gi3YeCRO8fFJsqLDO/72NIgEMzv8BDTf6aqqu9kSzjdSXKk3Npqi47z X-Received: by 2002:a17:902:eb85:b0:167:987e:2686 with SMTP id q5-20020a170902eb8500b00167987e2686mr474572plg.33.1655138216173; Mon, 13 Jun 2022 09:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655138216; cv=none; d=google.com; s=arc-20160816; b=ueKFaliajevy9Qv2ROUx6Lw7sFVORY4eUSGvscT88xhI3yKu48ebUCxWEvzBOudfqB +tBBnfAOZSQ0W3qgr1Ry7j7KQ2ZSam9AJCWVUk+TZr0jN8A6ag/hgbj6jWAy75LSP2jy ORAYt8iWe3Ad4g2gxUP3pSi5CuSSQkwNyJVRC9SwKwrVrzQ2taDf1sWYwvk1fW8zQD/u TNAaocqrlAvxrBKlfDMhTiHhjKukbmIUjsc4RqotSD/sNHLxdKBNvOif6ZB4ZYqPMslt I4Q0/cOYfhm/Hups8A+O1jpHvvrNXd9/ttebaZaJzghG3FHqbSWSEcUagLEH+sLAxBNA nMHQ== 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=mVFbxgR3aSCwJM/aJ12lNwimJSmdVNFEFKa69iUx98w=; b=qP8TsmEJ9JHtVYL12tI5KAid2xWqe5+93kjREqVTIS0Oq3svWihJcKzcXoRk4kBisf ecF7JKSKm5T1csrLUpkCFE/LnOtIQBifrChUVS3A/cUB2tEyFnvTErtrGQk6VeGAJACv MThFd+KUODukK11E3svpUG9fPMtE30xK8nIFB4YkVbkRYV67wWgPmj7iktgL9xbncOt+ VKCbeKP5mZPWtEV88as2oJq8uTVeE2boZcIKf4h+mJJ2g9fh+O/tzbHYa7PeAvKPhJGq y52Z3aE3jiZypqmf8OTxoNxPL2IUL8yL8CJuYUsDqEWRR0YL8wl3LPQjVgGu/cIJYrIc mewg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VZy8DPpA; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a63e80c000000b003db2f070ff8si9591589pgh.50.2022.06.13.09.36.44; Mon, 13 Jun 2022 09:36:56 -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=@linuxfoundation.org header.s=korg header.b=VZy8DPpA; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379606AbiFMNun (ORCPT + 99 others); Mon, 13 Jun 2022 09:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379380AbiFMNoJ (ORCPT ); Mon, 13 Jun 2022 09:44:09 -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 07B3D3FBF4; Mon, 13 Jun 2022 04:32:04 -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 8BC7660F18; Mon, 13 Jun 2022 11:32:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 956BBC34114; Mon, 13 Jun 2022 11:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655119923; bh=WKTuMowm7NIZSsSdu59fg+KqXc11VzPlvAw4VRHSJxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VZy8DPpA/Dv1H5AomF1mctbxXa/GYzlgN4cy1q4J7Q9vwdzjv8Endwt6zWvSnAi8p 6IiCB3L5XvKRywsgPx08o48EOrDwQU258reVGKPBrpK9sRUUpaAMbMM46T66rXCv/T TkgGvG7HsBXAnzTax0PyAORdCAMxN2FkMUFZ0JW8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Sergey Shtylyov , Damien Le Moal , Sasha Levin Subject: [PATCH 5.18 187/339] ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe Date: Mon, 13 Jun 2022 12:10:12 +0200 Message-Id: <20220613094932.346966600@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094926.497929857@linuxfoundation.org> References: <20220613094926.497929857@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Miaoqian Lin [ Upstream commit 10d6bdf532902be1d8aa5900b3c03c5671612aa2 ] of_find_device_by_node() takes reference, we should use put_device() to release it when not need anymore. Add missing put_device() to avoid refcount leak. Fixes: 43f01da0f279 ("MIPS/OCTEON/ata: Convert pata_octeon_cf.c to use device tree.") Signed-off-by: Miaoqian Lin Reviewed-by: Sergey Shtylyov Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- drivers/ata/pata_octeon_cf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index 6b5ed3046b44..35608a0cf552 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c @@ -856,12 +856,14 @@ static int octeon_cf_probe(struct platform_device *pdev) int i; res_dma = platform_get_resource(dma_dev, IORESOURCE_MEM, 0); if (!res_dma) { + put_device(&dma_dev->dev); of_node_put(dma_node); return -EINVAL; } cf_port->dma_base = (u64)devm_ioremap(&pdev->dev, res_dma->start, resource_size(res_dma)); if (!cf_port->dma_base) { + put_device(&dma_dev->dev); of_node_put(dma_node); return -EINVAL; } @@ -871,6 +873,7 @@ static int octeon_cf_probe(struct platform_device *pdev) irq = i; irq_handler = octeon_cf_interrupt; } + put_device(&dma_dev->dev); } of_node_put(dma_node); } -- 2.35.1