From patchwork Mon Jan 26 16:22:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 5711161 Return-Path: X-Original-To: patchwork-linux-arm@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 309589F2ED for ; Mon, 26 Jan 2015 16:26:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F30020145 for ; Mon, 26 Jan 2015 16:26:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 53A312012B for ; Mon, 26 Jan 2015 16:26:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YFmSb-0001bE-T0; Mon, 26 Jan 2015 16:24:21 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YFmRs-0000nw-Ct for linux-arm-kernel@lists.infradead.org; Mon, 26 Jan 2015 16:23:37 +0000 Received: by mail-pa0-f49.google.com with SMTP id fa1so12562059pad.8 for ; Mon, 26 Jan 2015 08:23:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hhpWs+mlHZbeVf8zb8XbtJuKqFClaYrVwdfMSwJnrME=; b=G90sbSv4mMFleSYfF3t5d5D9gWjAeVJ2ooMUJjCheAYlepZuWrhK1Yr1mscW4mFnLw AXH6F+mERIEBWUSqhLeKd2unmqDT3WwjpDz2veBVMX4In9xS9CxASDRletnFzMk6bVMO 8DJxYKcTGWDFgWkXe6/j4w6V/wyrJ+jU/CKWwfTZSWJasb0kRVvmO7EUCf3/+wQdazqh +iR1AKE2w12L0fIdCaUaC3lHPhgKXTV0NfEbejdsZe53Jo5cp6KrLJK5fYPQ7Uw5yF8j pSJHeZC/k2U4ttVMzVJ5wuP0kUdyzC90RPnPifY3/VK5sxgto06ncggtY3dehQCdLlDL WeUA== X-Gm-Message-State: ALoCoQmx6qzXtl/vQ6DvuPj1Gzud9ed2x+hCD+6sFqE32LaMMaD+lNOCX2OYa7Op4HHQhYP4zwdH X-Received: by 10.70.52.161 with SMTP id u1mr36039126pdo.44.1422289394909; Mon, 26 Jan 2015 08:23:14 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [70.73.24.112]) by mx.google.com with ESMTPSA id gr7sm10111137pbc.75.2015.01.26.08.23.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Jan 2015 08:23:14 -0800 (PST) From: mathieu.poirier@linaro.org To: gregkh@linuxfoundation.org Subject: [PATCH 3/9] coresight: fix the link between orphan connection and newly added device Date: Mon, 26 Jan 2015 09:22:19 -0700 Message-Id: <1422289345-2084-4-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422289345-2084-1-git-send-email-mathieu.poirier@linaro.org> References: <1422289345-2084-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150126_082336_465490_637D8CDE X-CRM114-Status: GOOD ( 18.30 ) X-Spam-Score: -0.7 (/) Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 From: Kaixu Xia When founding a component that has orphan connections, we should validate if it match the newly added device. If it does not match, only then should the @still_orphan flag should be set. The tested result as follows. pre: /sys/bus/coresight/devices # echo 1 > e3c42000.etb/enable_sink /sys/bus/coresight/devices # echo 1 > e3c7c000.ptm/enable_source [ 15.527692] Unable to handle kernel NULL pointer dereference at virtual address 00000124 [ 15.555142] pgd = c2294000 [ 15.564226] [00000124] *pgd=3d393831, *pte=00000000, *ppte=00000000 [ 15.585391] Internal error: Oops: 817 [#1] PREEMPT SMP ARM [ 15.603807] CPU: 0 PID: 144 Comm: sh Not tainted 3.17.0-rc1-12634-g1222fe0-dirty #3 [ 15.629490] task: ed3803c0 ti: c213a000 task.ti: c213a000 [ 15.647627] PC is at coresight_build_paths+0x1c/0x314 [ 15.664579] LR is at coresight_build_paths+0x6c/0x314 [ 15.681526] pc : [] lr : [] psr: 20000013 [ 15.681526] sp : c213be88 ip : c02da800 fp : 00000000 [ 15.720023] r10: 00000002 r9 : ed13250c r8 : 00000001 [ 15.737549] r7 : c213bee8 r6 : ffffffea r5 : 00000000 r4 : 00000124 [ 15.759446] r3 : ed216f24 r2 : 00000001 r1 : c213bee8 r0 : 00000000 [ 15.781346] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user post: /sys/bus/coresight/devices # echo 1 > e3c42000.etb/enable_sink /sys/bus/coresight/devices # echo 1 > e3c7c000.ptm/enable_source [ 59.934255] coresight-etb10 e3c42000.etb: ETB enabled [ 59.951317] coresight-replicator replicator0: REPLICATOR enabled [ 59.971581] coresight-funnel e3c41000.funnel: FUNNEL inport 0 enabled [ 59.993334] coresight-etm3x e3c7c000.ptm: ETM tracing enabled Signed-off-by: Kaixu Xia Signed-off-by: Mathieu Poirier --- drivers/coresight/coresight.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/coresight/coresight.c b/drivers/coresight/coresight.c index 6e0181f84425..d6052e2cd6a7 100644 --- a/drivers/coresight/coresight.c +++ b/drivers/coresight/coresight.c @@ -504,11 +504,12 @@ static int coresight_orphan_match(struct device *dev, void *data) /* We have found at least one orphan connection */ if (conn->child_dev == NULL) { /* Does it match this newly added device? */ - if (!strcmp(dev_name(&csdev->dev), conn->child_name)) + if (!strcmp(dev_name(&csdev->dev), conn->child_name)) { conn->child_dev = csdev; - } else { - /* Too bad, this component still has an orphan */ - still_orphan = true; + } else { + /* This component still has an orphan */ + still_orphan = true; + } } }