From patchwork Mon Sep 28 16:35:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804087 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 826F0139A for ; Mon, 28 Sep 2020 16:40:15 +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 52FEA2100A for ; Mon, 28 Sep 2020 16:40:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ev1SyeIg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="c+ufyza4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52FEA2100A 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=VSUt/tX06I3ig4H8JdQmDYFdFM2LLy+0vOOa+iG7HgM=; b=Ev1SyeIg8XgoSbXk02oj5sKwS TypqKSrJ4HfjaaIFcrqHcWr97LtJMKD0D1XgloUXpFGc+F0ye9cxZ792CtctDcTiOqogPn7Z9DMur yl1+pWA7aeoot4NWkx7MG1ylcgWi9nMMGWrP3ubUZI3QmY7VNeiL46khHLr4HuYewdpGfdLji60oV DNWONu8t0iszoCtVOP6pANAcWwcCRkgHUb7PqxQGQeYo5yMleWIQDD1HodG99OL4Y1rRM5M7FI5qM wUktlnjgYPZ+M8QG7/xZuxCCS6JLANFZeRcKCZ3RN8bMhT+vbh6pSC7qJauaWYC8pqH3C9o0ePkPj VeFl43Gug==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwBz-0002KR-NA; Mon, 28 Sep 2020 16:39:59 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7i-0000ck-VG for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:41 +0000 Received: by mail-pf1-x442.google.com with SMTP id w7so1526589pfi.4 for ; Mon, 28 Sep 2020 09:35:34 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=uQAZxuXMQGBtR+XEE1cJor4vajw3CBOa7U4wzhGgrBE=; b=c+ufyza4khJYPdz/3PTvWDJmufwz1AAjIsMmQ3Jhoze+AfN8okAxLuv5bXb1I5gKHw xhRyvrcc8iuDzXHgtCtJ2yxbculjTci51cPSOls9JCZuY6w1k1xGdi6Uu/9fZpl0cF67 E7XsFI09xHb4JOqOhgTwpUdcwYtWtpqKnOd8a2hoQOX7HSpip+UW4quUrFEsnQlT88M0 a+jedxS1/UMRuNKtOb0FGYoOkJDLwSC7Ewqq/oTY0rr+lvvsG5MrSc3bxLyM+QG5Xi7G 4nMytsyXHy1DkTavPX/EZqlJw5eXy3Pc+C0130bStbHGwfPQAZL7chLFGwgBA5LOUm3Q x6Ew== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=uQAZxuXMQGBtR+XEE1cJor4vajw3CBOa7U4wzhGgrBE=; b=fypTaW/WpFOmr59aJtBS/ewdCrjvs0nXc2bCESjUNoKJkYyVZ5+uqZtzRWUkbcvQBT r87+6+Bca4BreCYGPHkzHOc/0bf5kiqUBdhzYCD3kqpfKBHf4xP8VShl1IWZHDpDeBdr W4aNycs993el5fsDV0VWQqzBXZf2JaeJcy7WiKVEnfkKickKnh8BVq6u0PsOuJ51xewS KXbRIblThYqmr3Pl7atjFaCyMZjAq8MplNVC8ZiGWRekQJ91pwfgWULAH5LVo9Erknxg jNA1jwUaM1gP0bBHEkb0KgNJ5Kf7VPo+TnqFAqMShB+lSToi/KHwWCqxEmCY4syE43yI b80A== X-Gm-Message-State: AOAM531taq415jqGbR4LQj8g+5YUYXujyaNdqZhiDMve2GipsoVeWMdk mXV097UMGm9XnUZnlJe3QYnkwg== X-Google-Smtp-Source: ABdhPJwWvP15f/fbhVDpd4HCUcyFdHiHD7t1vvnFgxCgXFUH0LfFZUnvzJ9ZCHomH+zStSj3hDAclg== X-Received: by 2002:a63:c00d:: with SMTP id h13mr1816537pgg.358.1601310933065; Mon, 28 Sep 2020 09:35:33 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:32 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 17/25] coresight: cti: Fix remove sysfs link error Date: Mon, 28 Sep 2020 10:35:05 -0600 Message-Id: <20200928163513.70169-18-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200928_123535_107637_F70A0B72 X-CRM114-Status: GOOD ( 14.67 ) 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 [2607:f8b0:4864:20:0:0:0:442 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -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 Message has at least one valid DKIM or DK signature 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: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach 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") Reported-by: Tingwei Zhang Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- 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 5003d1f59af0..abc8b32e79b3 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -494,12 +494,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); } @@ -589,7 +592,7 @@ static 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; } @@ -641,7 +644,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; } }