From patchwork Tue Jul 21 11:17:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 11675495 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC23613A4 for ; Tue, 21 Jul 2020 11:19:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4F1B20717 for ; Tue, 21 Jul 2020 11:19:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dOnMhdu6"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PLqY/jzC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4F1B20717 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=3Q6YooFX0nnPf38WpgigFYa/VbGeD7uV5QiE8gsZYng=; b=dOnMhdu6c69I317Nn3xjh6uLrJ de9LJgzTFVbQA1C6JpAwOL0wEQQ/5BK8RR6DN5ncoQ0dM6KhJ1/ZE0gklwYzk/6nMidiChfTBQL5E xI0NQL8eDwoCUmUI5CnNRE5J3K5UMKHbL9pV+hYIr2OsLCXHCiaQXJX8V17tqQOLIqlutmv2ktgyQ sr/o6soX9Iu/r3e4zUCNTgSk3E4KPF1EIYH/QA2tor2DVganqAn93zGyXNgRkFygGJKvCQwqqRAbj QFW4Rcj275KTG8Fyn398Al5y9LqiMw3rF8rraX7yiEahKsyNmSdbq42oA/ORF5UZMqRlmXkdH4suX 6u8qeulw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxqHI-0008Ut-Hs; Tue, 21 Jul 2020 11:17:44 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxqHF-0008U1-ES for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2020 11:17:43 +0000 Received: by mail-wr1-x442.google.com with SMTP id z15so20782863wrl.8 for ; Tue, 21 Jul 2020 04:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=M+xdWnTdYWuytR2/rH0Edx/Q3qcHZYdZDJCQVszgfZM=; b=PLqY/jzC9uP2GOuGz9XBa1z+H3ojXuJvMcsKeP++3Wp77d0rLw1X2M8/RTnDgAxoOE mFT1818yGaRRgx/SisQT/7OvYYLVB5d4K0RPCnagQc2/HYvtrcjhvB75KaWe+AAU35x0 J441Hg+sNe8ShbosnS+RVdNxUuj4TuZHBHIZhTvIJSsVDcBBWiKsj/3fYJ7j35e5efwV n/FjcGPcKejq9OLFSA4RGv6EtYpWjdLsXcYoX7NniFGkBfw220zAOSU/Dl0fIMS3zI7e ielArynxjEW15hli7wvHu933vLOoxfUf8Da5QA2cKoLsGuFH8Zo98wZ+n5gqSSlg3EHD hAbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=M+xdWnTdYWuytR2/rH0Edx/Q3qcHZYdZDJCQVszgfZM=; b=X5ZKi2YwkyLmsz4s4XH5DlbOLb9LSzorZMg6pSJvX0xQ96tmg1V3kWG7IkXQC9SJ3c Of3+dlr8FSrK8yPAAJGiUStVJrdmkHZXYdETujMNYP3gcBCb9xyNJoVdBwaDcpwDUHyR 5bcc4FTCYAMe6XAjqRUw5RcdNIdIXNxHq6Wo0QFI4tbQh28Mx4Mv0KVMtcnzVuDD6vbI rpqQdkI7IWmmSssNXGL/rdna67fDDTGNvYfeC/sCAKh0AAiu5RigIz5DBRXvn2OAP6Do i7uxcJcdQLPMijZN0N9QegMHqrBxZGakgV7cmZRd0uFsGWAudr6zCHQDuWVwKUa76VB6 VIHA== X-Gm-Message-State: AOAM531Fz631xZZEZX/1tNFGaiZ2ow7PXOh8+JhiNNJd9QRf1wA+hmpT BUEF+kNRFOuaNPCqTMNbD1kOQtMM8yM4Eg== X-Google-Smtp-Source: ABdhPJwQNX3F11VdKSTpu2yWXGd6HD4w6luFgji+cv9DNRM86OPcStkpze2fszidhH1YAAhZtChSqw== X-Received: by 2002:adf:edd0:: with SMTP id v16mr6390068wro.271.1595330259185; Tue, 21 Jul 2020 04:17:39 -0700 (PDT) Received: from linaro.org ([2a00:23c5:6801:1801:8bee:312:6092:58f2]) by smtp.gmail.com with ESMTPSA id s19sm14926232wrb.54.2020.07.21.04.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 04:17:38 -0700 (PDT) From: Mike Leach To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org Subject: [PATCH] coresight: cti: Fix remove sysfs link error. Date: Tue, 21 Jul 2020 12:17:36 +0100 Message-Id: <20200721111736.10805-1-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_071742_435716_B58DBAB1 X-CRM114-Status: GOOD ( 11.39 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mike Leach , tingwei@codeaurora.org, suzuki.poulose@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org CTI code to remove sysfs link to other devices on shutdown, incorrectly tries to remove a single ended link when these are all double ended. This implementation leaves elements in the link info structure undefined which results in a crash in recent tests for driver module unload. This patch corrects the link removal code. Fixes: 73274abb6557 (coresight: cti: Add in sysfs links to other coresight devices) Signed-off-by: Mike Leach --- drivers/hwtracing/coresight/coresight-cti.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 3ccc703dc940..19d0b031a7df 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -511,12 +511,15 @@ static bool cti_add_sysfs_link(struct cti_drvdata *drvdata, return !link_err; } -static void cti_remove_sysfs_link(struct cti_trig_con *tc) +static void cti_remove_sysfs_link(struct cti_drvdata *drvdata, + struct cti_trig_con *tc) { struct coresight_sysfs_link link_info; + link_info.orig = drvdata->csdev; link_info.orig_name = tc->con_dev_name; link_info.target = tc->con_dev; + link_info.target_name = dev_name(&drvdata->csdev->dev); coresight_remove_sysfs_link(&link_info); } @@ -607,7 +610,7 @@ void cti_remove_assoc_from_csdev(struct coresight_device *csdev) ctidev = &ctidrv->ctidev; list_for_each_entry(tc, &ctidev->trig_cons, node) { if (tc->con_dev == csdev->ect_dev) { - cti_remove_sysfs_link(tc); + cti_remove_sysfs_link(ctidrv, tc); tc->con_dev = NULL; break; } @@ -651,7 +654,7 @@ static void cti_remove_conn_xrefs(struct cti_drvdata *drvdata) if (tc->con_dev) { coresight_set_assoc_ectdev_mutex(tc->con_dev, NULL); - cti_remove_sysfs_link(tc); + cti_remove_sysfs_link(drvdata, tc); tc->con_dev = NULL; } }