From patchwork Fri Feb 10 23:43:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yabin Cui X-Patchwork-Id: 13136655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 34149C05027 for ; Fri, 10 Feb 2023 23:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=VZPQ1zcM+qRL+T7UU8r8Tkwyra5N0PiiuciWMGFtdX4=; b=h1EO1O6SvZeh6f9aE6lmGnctxR hXbvlO+8/wL5RJK7MOX3Tn/ftA8olEkiVlJgIgmLSEH2Zarv7eVOwIr7FZkVeLCAiJg3Nau258sMw Wf0d41e2AbxyrziB0kSxEb5d3c1wBR99Td/0i3ICFKKpdVXxrDg3oMhEXOj6J8Mx3Qc9EizGdK1md XXwsrIfTd/Dcpuo9ATaaqOeaUJVecJh0JTosg3pqmI0FsmeeSomSuWG33fDzJIFPoh88euWBKzzb+ 8pX7KzfjKaTbMjsVYFOCTN2VfE/bZb0wWYufc6X0aSjrrWVcct9LxEQebcEKwmJE4ERVTl2C3H09w A17j6B3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQd3n-007zvT-Md; Fri, 10 Feb 2023 23:44:07 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQd2z-007zXB-PA for linux-arm-kernel@lists.infradead.org; Fri, 10 Feb 2023 23:43:19 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-4c11ae6ab25so64032477b3.8 for ; Fri, 10 Feb 2023 15:43:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Pq9DLVAB41UZ1daqP8qVvrbiDLfr0Ia2Jjzuq86gY04=; b=KrZ7DNmZ42tI5fQi8ZYQ8u5FQYFpt1VhiL6mzYE9CHt0L714pWDmufaxMHurT+kdiE Svr4VMAXQeviO5JBD5BVjouyVXC+1GnXD/8oTkob0RdWsgP0T7oCiDzGIF107Cx/mG9E 2VfyAZeiVJnKfLSiXhRPicXaHNSepmhhMa7zCu3LglKB2s/LC7ISPrbm3E0KXGIiaqCV QPrhtYXkn/tnL7mzdDcDIdGTKe61oNmtqwl+hCzbKpEbP6yo4YgRaVbz3j5u1bXN9jPX 5MJC0Vl14rDR0nHCJw6YfM9Z4Wtj5CJ6SVUK6zvlk70vwOvMmGHTqnOGjtNNi+/WZAEg eghA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Pq9DLVAB41UZ1daqP8qVvrbiDLfr0Ia2Jjzuq86gY04=; b=1o3VzVSK2nTqv1GTq3pI2YUfVOnd3/YLFe6u0lTBUrWNuDuyHiCFbN9D7JOMC82sYf OA+iu6DQ+stRwfo6E5juZGYm7W5dgR6efxTr0d/DLcKQRCUg6yK9Y+/sniNu2jqkbvnF GaEjogkAokcjs198SkZD2R8Czxy9qEXaB1qA6HX8Ho9uXIDkQI6cE1ClfrYsfL9h3QGt tSoZgT1cj7eXKzlVUC0M/2rB7kD+gb0uk4HyzpjUTUERXVt7YsiCm+UsacwMkl7ueItj JViEV8VAljFmbo0o8lr4IvdQfw15d8xtzygxXvdQlxYJ/n0Zx04Vo4B1+Pl1XFl7jDnr FKDg== X-Gm-Message-State: AO0yUKVC6I8ZiBp7y/G56JyNMJ6+TEBt9mkGc9E/qmrYmRUScVZGlaPa 5ZL6+mwWTdX5hN7WiXd+XEcOjpHoag== X-Google-Smtp-Source: AK7set+DKY/drm0mS9tbjkL+T1bR92BB3DTMNmSO/2PR/B1VzsIiQPtiJf7TIhkfwhi+oLoO+fkel1qGa4M= X-Received: from yabinc3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:1274]) (user=yabinc job=sendgmr) by 2002:a25:8708:0:b0:8f4:2e76:d2b0 with SMTP id a8-20020a258708000000b008f42e76d2b0mr1ybl.6.1676072593951; Fri, 10 Feb 2023 15:43:13 -0800 (PST) Date: Fri, 10 Feb 2023 23:43:11 +0000 In-Reply-To: <77bd4509-bd8b-3bcc-e94a-7593505e27c0@arm.com> Mime-Version: 1.0 References: <77bd4509-bd8b-3bcc-e94a-7593505e27c0@arm.com> X-Mailer: git-send-email 2.39.1.581.gbfd45094c4-goog Message-ID: <20230210234311.1661312-1-yabinc@google.com> Subject: [PATCH] coresight: tmc-etr: Handle enable failure in tmc_read_unprepare_etr From: Yabin Cui To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , James Clark Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Yabin Cui X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230210_154317_874208_498FD424 X-CRM114-Status: GOOD ( 14.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It's similar to what we did in tmc_read_unprepare_etb. Signed-off-by: Yabin Cui --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 918d461fcf4a..b04f12079efd 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1763,6 +1763,7 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata) { unsigned long flags; struct etr_buf *sysfs_buf = NULL; + int rc = 0; /* config types are set a boot time and never change */ if (WARN_ON_ONCE(drvdata->config_type != TMC_CONFIG_TYPE_ETR)) @@ -1777,7 +1778,11 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata) * buffer. Since the tracer is still enabled drvdata::buf can't * be NULL. */ - __tmc_etr_enable_hw(drvdata); + rc = __tmc_etr_enable_hw(drvdata); + if (rc) { + spin_unlock_irqrestore(&drvdata->spinlock, flags); + return rc; + } } else { /* * The ETR is not tracing and the buffer was just read.