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: 43768 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F39E620D5D for ; Mon, 26 Jan 2015 16:25:34 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id ge10sf4860090lab.1 for ; Mon, 26 Jan 2015 08:25:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=tHHurLz09sg7vXu1CYt3cbrp+ip/hBT0iqtWPly0/aY=; b=WPJxiyi8bTvu9OyECRkldoIFqw2ZbN1YTUViQhuyC5ocHA/yAi0XrEXbBzk8sHa3hy ukt28qKjL8wciaUI+WKAUO6vhMZKlJhStduibIS+HAJhXe/ZaqYNq+xU8wG8lnV1gHSB 7lK4Q3Mx2zwSphooQl8EjEmfP4MqoMmE2yO5zr+e9vm6H0pLA7HMU37d0RwwOXUOfoDV TWcLnvhHRn9EE1RuUeoS+A5MMgp82AUBRdwtn5bzvgEenLp01Yi0FlHzPQMmwhFJDmiV Obh7H1DSgZMhnwpnXptvggnKZhS3vfMUReSd4Z+7rGEF0x8rWrf/elT5a0MaLRewf3Pf Y9SA== X-Gm-Message-State: ALoCoQlnTIyX1lWLQt/jyvPKykVs7KDETERKyeGNQPykVzOWIwroDhsM86FZGW+on/5/cUYQBRk2 X-Received: by 10.194.178.234 with SMTP id db10mr2697008wjc.2.1422289534003; Mon, 26 Jan 2015 08:25:34 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.49 with SMTP id o17ls297696laa.24.gmail; Mon, 26 Jan 2015 08:25:33 -0800 (PST) X-Received: by 10.112.17.197 with SMTP id q5mr22132701lbd.30.1422289533792; Mon, 26 Jan 2015 08:25:33 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id d5si9446816lae.11.2015.01.26.08.25.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 08:25:33 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id 10so8451665lbg.6 for ; Mon, 26 Jan 2015 08:25:33 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr22089009lal.29.1422289533700; Mon, 26 Jan 2015 08:25:33 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp829050lbj; Mon, 26 Jan 2015 08:25:32 -0800 (PST) X-Received: by 10.66.184.48 with SMTP id er16mr35420287pac.61.1422289531827; Mon, 26 Jan 2015 08:25:31 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id d2si12653041pat.238.2015.01.26.08.25.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jan 2015 08:25:31 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; 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-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 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.49 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.49 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mathieu.poirier@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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; + } } }