Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp441750iog; Mon, 13 Jun 2022 06:05:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw09/LLys6+E/UHWY2Dkn1h6zUrILZMnzaxI+LFoEAVJ3kZXA49eleJurtF5OIX275MnD38 X-Received: by 2002:a17:90b:3b4c:b0:1e8:5e4d:ed83 with SMTP id ot12-20020a17090b3b4c00b001e85e4ded83mr15714814pjb.19.1655125412687; Mon, 13 Jun 2022 06:03:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125412; cv=none; d=google.com; s=arc-20160816; b=UJwj9PK4QwJa1nEAj7LSxeDl6mpJHgzRwSWm5KWuE1CgEGxORQJ+L0D/OArA8PQuYD 6ypKTqodAN8RxfbQkEyRGM+owPDDz+0FJ29j55Vuiw4Z9J5Yx/vphYndzQGOQIP8PcPb Dkdjz4t+FkCIY8kufwZl3V/+ZDUGMgOjvD7/fNNID46HsL+pajNsNxZqzAebAmZ5WSiJ fyegR7XBHo+lu+W0aqOqm51Fyychcosm2R+y6cq94nclsbJCq4qCe30/fKPpNwfEwpNg M8gzEiCtYShZ9j2h02nDIsDRYCo82YFL1BwlI0LgxJiigP2wPws0MiHKgMVy6xxpiBYe xJ7Q== 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=YovEuNPKfXnBtuIX4n0mt2yVbdIe4lV+h/FeY2IOrws=; b=J90WhmE2AoIS/WyW074sssqdhpAa93ARKu2v0ykmAjZySh9au1Dlg9p9M/kQJX8E56 60hfdvfZkaj2X6UuStJ6aEXCAPciZsCutxsrgmXwp1N2cr3Z61KtPV3X3Pj5V7elGIeW DNpP+K2muIfPIUdNyKdpyB6SFbfOnLK9ZzO9H1m+sSQ4ao/cHcH/q6MxXvv+lO55R6de xA35lb+5KPkVfHOTRxthz91Sy5O5OkhRWI0cvE51FdejSB2hk2UJCN2CmQyhuKJZwmJM z7ygIPfAoK3DoOYVnn/Rauxap0tjedE4keynNaYIQK11JOXF8G9LxoC/nU8hd+Jl4i3n PEuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VL1jq8bL; 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 kk14-20020a17090b4a0e00b001d1ad44a667si17004195pjb.6.2022.06.13.06.03.16; Mon, 13 Jun 2022 06:03:32 -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=VL1jq8bL; 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 S1351484AbiFMLGT (ORCPT + 99 others); Mon, 13 Jun 2022 07:06:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349848AbiFMK6b (ORCPT ); Mon, 13 Jun 2022 06:58:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BE771099; Mon, 13 Jun 2022 03:32:22 -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 ams.source.kernel.org (Postfix) with ESMTPS id E51B6B80EA3; Mon, 13 Jun 2022 10:32:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E038C34114; Mon, 13 Jun 2022 10:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116339; bh=y7GlcwRD3danYGc5bP/xB3Bm0BKDs6VAvErmOMRmARM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VL1jq8bLtC9OxrD8wYYJMsFGr2QkFQFqsSCi2K4+NeuWtI4UyOKd7KjTPe8Smm04w 6ihyzyFy8t/0Gq+y+sT8RdnFP4Ox4wCRRJRIecG7JBZztvQGzMjXNUZp0VWv7S2iI1 pzawEMyZNnkToZmKdGkCPRgZZBjZ9HqaUZfK7ixU= 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 4.14 173/218] ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe Date: Mon, 13 Jun 2022 12:10:31 +0200 Message-Id: <20220613094925.852633366@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094908.257446132@linuxfoundation.org> References: <20220613094908.257446132@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 ac3b1fda820f..c240d8cbfd41 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c @@ -888,12 +888,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_nocache(&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; } @@ -903,6 +905,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