From patchwork Wed Oct 28 22:50:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7514891 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 432A29F37F for ; Wed, 28 Oct 2015 22:52:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B0BD320978 for ; Wed, 28 Oct 2015 22:52:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6A8A20734 for ; Wed, 28 Oct 2015 22:52:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756229AbbJ1WwB (ORCPT ); Wed, 28 Oct 2015 18:52:01 -0400 Received: from mail-bl2on0093.outbound.protection.outlook.com ([65.55.169.93]:17312 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754513AbbJ1Wvc (ORCPT ); Wed, 28 Oct 2015 18:51:32 -0400 Received: from BY2PR12CA0007.namprd12.prod.outlook.com (10.160.121.17) by DM3PR12MB0857.namprd12.prod.outlook.com (10.164.7.139) with Microsoft SMTP Server (TLS) id 15.1.306.13; Wed, 28 Oct 2015 22:51:29 +0000 Received: from CO1NAM03FT007.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::201) by BY2PR12CA0007.outlook.office365.com (2a01:111:e400:2c84::17) with Microsoft SMTP Server (TLS) id 15.1.312.18 via Frontend Transport; Wed, 28 Oct 2015 22:51:29 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp01.amd.com (165.204.84.221) by CO1NAM03FT007.mail.protection.outlook.com (10.152.80.117) with Microsoft SMTP Server id 15.1.318.9 via Frontend Transport; Wed, 28 Oct 2015 22:51:27 +0000 X-WSS-ID: 0NWYCTN-07-6DL-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 22F42CAE635; Wed, 28 Oct 2015 18:51:22 -0400 (EDT) Received: from SATLEXDAG03.amd.com (10.181.40.7) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 28 Oct 2015 17:51:37 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag03.amd.com (10.181.40.7) with Microsoft SMTP Server id 14.3.266.1; Wed, 28 Oct 2015 18:51:22 -0400 From: Suravee Suthikulpanit To: , , , , CC: , , , , , , , , Suravee Suthikulpanit Subject: [PATCH V5 7/9] of/pci: Fix pci_get_host_bridge_device leak Date: Wed, 28 Oct 2015 15:50:52 -0700 Message-ID: <1446072654-5608-8-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1446072654-5608-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1446072654-5608-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(77096005)(50466002)(36756003)(48376002)(19580405001)(50986999)(5008740100001)(53416004)(101416001)(5001770100001)(76176999)(86362001)(5003940100001)(50226001)(5003600100002)(5001920100001)(19580395003)(2201001)(105586002)(5007970100001)(106466001)(189998001)(47776003)(11100500001)(2950100001)(229853001)(92566002)(87936001)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR12MB0857; H:atltwp01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0857; 2:qghNo6DSg2vaFgEuLkgM/zh5/EljE7dcYMebT8cUouGYG9xe3DiPSh1CqjxQzhLPx1kVkddnapyqc1FV0DKLYFvox7Rz1IlUGsNeEgBVh7Qn8Bfvib/SAYNDJhzm1wIA71ITKiF3fyp62rHvofITrz61N9B0mm26pMd9C1gwtXA=; 3:UhIpqJXZcMMx8EnkVn0jWbZFZ0j5MtlKybrg2VxFIS7XgwLsuGvLZ4S3t8ANFl9Q83c/FCL5ax9FZ6Q2uBB612ifV2K9RvUKx1U2yvfTJjtUB5vGQ0lhVzwLCmhnuQ3mzOd4zhwNQgLFWgp4iUt6+zIt/p8ZgRp9R8Kgc8L8wPF7Ta2FXjO84TofMlERRFjADZR2rI3gqSR+xgvDtJCEqK+YfI6dSsNDAIQKRD1q1Vs9P8BAUdouGGrNG7WH3C8J; 25:BCjRk0t8AaKksBpNAmX8x6+NqGgJwuiLFdKsoyptHk0HZWBsVF/MFprzKIofJtSXQdbcRg3ScfQvWDavBbtIDEWQYIGEv7/qyY8lehTGQvzIzQrLUO/OyjKGHmqU0MEwVABFwkjKZqOTJW81WZpXY4QCxGGgFk/Op5BVvGlAEwa9rWIvxsV3qVaXmUn8oxCB675aDLp0vdpqvJflQdTXOCQ2GlBa1/qAT/ExpcamJ1yBLASTInkUfeAfyzrJqp2rbxeDmu+gIiq516hSXRi3qg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM3PR12MB0857; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0857; 20:VQmQt9IsKGr+x+hNQb1r9hpTOGlNrVWjvqplGJvJ6WlVraQoBr/hevQNXcjlwjetV+0bB9EiasC4rqDySn3aMOF/brnP3SXyrYwuoIJSGKCCe5t74PlZCYAAEgOY1aVooqYQCwT6dj3tjtxlpPMLFd6akCwYB6ZbwM4gjvOGbMCavYIO2FvnupQpU64rxgfMRcoFXk/LnEyKIatFsvcRMYW8eqInRQxfnjuMPA3dtaTsVLCcWkPXPLUTfloPVtJ0X3fAj4WsXGCB0BsZyxjDRNTRg2DhCeOD08G+JsvYdqytkahfj4FpU6AQaYCHbo3iOsCdh5IM098GHuUzq4ZZCSWCHjC0CdaAWJ413EGPiV60lshjIU4gd+PxTU7MSFg5+v16Ogd7/kwygpw2OeklMTLFxucdCwDElQsmXrHGXp8WSwuKpbolSkJRIiBIZSdwL3h7gA04WZtOy9qHb4vZALSfnPzSE+UGKiVVuLchrJUIYt6lORxrcMjJDpNrqIvf; 4:DsFQDJzCWcDyrdj1gozl0grYLlucc0NmOYJBotHlI6Whf9/VShNbduZ3Pqgyq4Y/2cmUw2BhzHspbp6HhXzLtnuDSHSe1Ulw/QWw0Hr58jyCVG95wEUAFS0T0X4g0tIGjRMoH5BEz6ZmncOsYrnt/FfBaZnPPvXxw0BFQgx3uIp8O9PLHT33VFU9axS68B+ZbZNrfwXK8H0kTTmIEeIB8tozjN7niyrZxGP5lBVJOxj5vNU+R/C5tWUtcvoNIIYTVXQmJtzm4KYogtLUxiM4UvYedRL6UcS3eBsI30QfCjlYexaLoEBCVvXh5EJcwZJM1vorUWZxCJsoHd1jFbb+7Mh1HLw8RpS1Zs9+AHW8r5oHMbfkL/Z+yjNNuFFq3q1O5I1ZOY8GBO//aziaOhDHBg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(10201501046)(102215026); SRVR:DM3PR12MB0857; BCL:0; PCL:0; RULEID:; SRVR:DM3PR12MB0857; X-Forefront-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ascii?Q?oqbXJ8kiZ8VdNG4hHL1uzOEL7rGC0kwiochFBqraYi0Ag19FE6OJEEi5NOuc?= =?us-ascii?Q?5MWx83F3OeSypTXgV21sx84GEiEMN5gz7ABLuKZwLxkfEEa3ooG7/0r3J4AU?= =?us-ascii?Q?8666X973p7sDbVaqR9uMD0i07uO8nkgT7xOgUc5QA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0857; 5:lIoL5mTYFossL7P48MLT1Gyy41oWOm/BTE2Ss3b8V70U9Kqqf5tQl1LD9VFyhYd6AEVSqc3MMs+nlQNUDI2goB/X5p24mUTMI6EKX1+5JWGVe1du7S4n1QI4URqiXOoGz42MFEtwcdMG4FSuWxMgjA==; 24:an/bqihWkjfZqEj1pYqb2y30YBhoGkY9oZEW4aaFKEl2bzQce+42HpC0BJNV9HBzXy+DVMauUCt/4hXPjlQlj21QtTa+lgQkFnFtEUYwWiQ=; 20:xZa+YJNB+A9hxOJNQewruVIQ25Hd+We+3Tqh7zt1wbCnyueAnbmpoNkruBmSAbPiF4yam6d0L2gDzwKOYKbsy6wOjU5mIAftEYp9bCQ0WlZYfUrUf/3OIVLUu8N9gjLYtpTKSNen96ugb4+hUj8vSXobGsXgeAYPm9l+eBiDLVy8QRTSwDpptcVrvjym2Uy5ygJb5hbdfooPoD2rWADzMJ1SOvilyUk3guNPa66/Pt7xJwKqqg2cntihvDNND+ro SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2015 22:51:27.6491 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.221]; Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB0857 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of error, the current code return w/o calling pci_put_host_bridge_device. This patch fixes this. Signed-off-by: Suravee Suthikulpanit Acked-by: Bjorn Helgaas --- drivers/of/of_pci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index 5751dc5..a2f510c 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c @@ -129,10 +129,9 @@ void of_pci_dma_configure(struct pci_dev *pci_dev) struct device *dev = &pci_dev->dev; struct device *bridge = pci_get_host_bridge_device(pci_dev); - if (!bridge->parent) - return; + if (bridge->parent) + of_dma_configure(dev, bridge->parent->of_node); - of_dma_configure(dev, bridge->parent->of_node); pci_put_host_bridge_device(bridge); } EXPORT_SYMBOL_GPL(of_pci_dma_configure);