From patchwork Fri Feb 7 16:25:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13965446 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 B4E97C02194 for ; Fri, 7 Feb 2025 16:26:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 36D8610EB71; Fri, 7 Feb 2025 16:26:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.b="IsbGU1an"; dkim-atps=neutral Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id C4F7E10EB71 for ; Fri, 7 Feb 2025 16:25:59 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1738945558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sn0a84LV83FbtYgNJ4zSoh8nNRElw7Uji670f7zb7LM=; b=IsbGU1anshlM1CRTqZjHlSwaUX9IGhKzANB7px9fpOzmqY/osEQc8c2J4gKNuJQx8/vSx0 ZVgRfZU61uhr4PISnxgcqNmgq6++91s8N09mxoJmiXTcYDc4ElzeXwRqoUX3TKK9xP84YW Xpr+4G4PddsdlaV3phQQK+jvN0OE/C0= From: Sean Anderson To: Laurent Pinchart , Tomi Valkeinen , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR XILINX) Cc: Maarten Lankhorst , David Airlie , Simona Vetter , Michal Simek , Maxime Ripard , linux-kernel@vger.kernel.org (open list), Thomas Zimmermann , Bart Van Assche , Dan Carpenter , linux-arm-kernel@lists.infradead.org (moderated list:ARM/ZYNQ ARCHITECTURE), Sean Anderson Subject: [PATCH v2 1/2] drm: zynqmp_dp: Fix a deadlock in zynqmp_dp_ignore_hpd_set() Date: Fri, 7 Feb 2025 11:25:27 -0500 Message-Id: <20250207162528.1651426-2-sean.anderson@linux.dev> In-Reply-To: <20250207162528.1651426-1-sean.anderson@linux.dev> References: <20250207162528.1651426-1-sean.anderson@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bart Van Assche Instead of attempting the same mutex twice, lock and unlock it. This bug has been detected by the Clang thread-safety analyzer. Cc: Sean Anderson Cc: Tomi Valkeinen Fixes: 28edaacb821c ("drm: zynqmp_dp: Add debugfs interface for compliance testing") Signed-off-by: Bart Van Assche Reviewed-by: Sean Anderson Signed-off-by: Sean Anderson Reviewed-by: Laurent Pinchart --- (no changes since v1) drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index 979f6d3239ba..189a08cdc73c 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -2295,7 +2295,7 @@ static int zynqmp_dp_ignore_hpd_set(void *data, u64 val) mutex_lock(&dp->lock); dp->ignore_hpd = val; - mutex_lock(&dp->lock); + mutex_unlock(&dp->lock); return 0; }