From patchwork Fri Jun 17 06:26:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9182607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A4C6B60832 for ; Fri, 17 Jun 2016 06:28:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94A0A27EED for ; Fri, 17 Jun 2016 06:28:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 894712839F; Fri, 17 Jun 2016 06:28:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D22A42839C for ; Fri, 17 Jun 2016 06:28:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933381AbcFQG20 (ORCPT ); Fri, 17 Jun 2016 02:28:26 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:57146 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755198AbcFQG1U (ORCPT ); Fri, 17 Jun 2016 02:27:20 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O8W00MCOKLESF90@mailout3.w1.samsung.com>; Fri, 17 Jun 2016 07:27:14 +0100 (BST) X-AuditID: cbfec7f5-f792a6d000001302-28-576398426c4d Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id EE.5F.04866.24893675; Fri, 17 Jun 2016 07:27:14 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O8W00HUZKL21910@eusync4.samsung.com>; Fri, 17 Jun 2016 07:27:14 +0100 (BST) From: Marek Szyprowski To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Marek Szyprowski , Joerg Roedel , Inki Dae , Kukjin Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , "Rafael J. Wysocki" , Ulf Hansson , Mark Brown , Greg Kroah-Hartman Subject: [PATCH v2 06/10] driver core: Avoid endless recursion if device has more than one link Date: Fri, 17 Jun 2016 08:26:56 +0200 Message-id: <1466144820-6286-7-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1466144820-6286-1-git-send-email-m.szyprowski@samsung.com> References: <1466144820-6286-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLLMWRmVeSWpSXmKPExsVy+t/xa7pOM5LDDe4947DYOGM9q8XUh0/Y LJoXr2ezmHR/AovFgv3WFp2zN7BbvH5haNH/+DWzxabH11gtLu+aw2bxufcIo8WM8/uYLNYe uctuceb0JVaL42vDHfg9nhycx+SxaVUnm8eda3vYPPbPXcPusXlJvcfkG8sZPbZcbWfx6Nuy itHj8ya5AM4oLpuU1JzMstQifbsEroy5XYEFM9gqHvz/x9LAOJ+1i5GTQ0LAROLGtPWMELaY xIV769m6GLk4hASWMkqc/rieFcJpYpL4se4zG0gVm4ChRNfbLrAqEYGVjBLb9uxjBnGYBRYy SzSvaWYBqRIWSJS4u+kKE4jNIqAqsX3TCrA4r4C7RMPi5ywQ++QkTh6bDHYHp4CHxItbP8Di QkA1uw6fYp7AyLuAkWEVo2hqaXJBcVJ6rpFecWJucWleul5yfu4mRkggf93BuPSY1SFGAQ5G JR7eFaLJ4UKsiWXFlbmHGCU4mJVEeEsmAYV4UxIrq1KL8uOLSnNSiw8xSnOwKInzztz1PkRI ID2xJDU7NbUgtQgmy8TBKdXAWHlXgy3q0/uZx9oW/uo9Je7jdaDXYrZOYseR1r/apjO1W5k2 rK2tu8+st1JzfWex9z2pV3dOHl07lfOHQ9FdvhkajbXhJ81C9hmFP1TdeOKtk09o1U75ZO0G h815cl+mlOkrXndveNY4Y7en6oPVBg0dUvsPME151Djd707Ex8wnE9Y2W6osV2Ipzkg01GIu Kk4EADvtkZdgAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes endless recursion, which happends when device has more than one link. Signed-off-by: Marek Szyprowski --- drivers/base/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 215cd44de761..4e778539b750 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -57,7 +57,8 @@ static int device_reorder_to_tail(struct device *dev, void *not_used) device_pm_move_last(dev); device_for_each_child(dev, NULL, device_reorder_to_tail); list_for_each_entry(link, &dev->consumer_links, c_node) - device_reorder_to_tail(link->consumer, NULL); + if (link->consumer != dev) + device_reorder_to_tail(link->consumer, NULL); return 0; }