Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp661509ybt; Wed, 8 Jul 2020 08:42:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxNOBSxAkVeGY9w+weAaEg3Rp1pXbkGOwus0BpDXcsks/5VSqmFNH+brnaNFo3LeXnbBVz X-Received: by 2002:a05:6402:1bdd:: with SMTP id ch29mr57130322edb.134.1594222924867; Wed, 08 Jul 2020 08:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594222924; cv=none; d=google.com; s=arc-20160816; b=Le+UujNrA7L83b9X2FhuzZyiwIEQHUBJnJjTN8PD/avz86OBlM71LkJhRmofyxjJsw Cb+n92ud1yQ69NsMHkNjb/TZAfCK/5+4vykSraePcijNOUulods3EsqeXBtzPl6OG7W6 EFjTbxnOilaV014K5aFOLTeBzbPjZQOLhvygv0YxfsrZPtItUYjZg5uHGgR/1FmbDRUT JoLwHDIjPapuWMVKb/CcFkbCj3OckTqSK6i572+2k1v+oiAJ8alvjlT5Qjb32iUXvZEH 2erIgNPvx3C00TULZHiIWNbZ1EMSGNrh4DclJQ2La5n47QTfcR5tfVzNtTBQHsVJ++KA cNIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dQjmS7Wcdthn3UMZoz9fxKOLZqVwCNMbK/h5DazykXg=; b=c7/gbJL7jpvUNBhLltIZvQO7H4TSctXLGO163IqiQV+lQiRLUOnxE7vxnsNS0U3ibb KNSxejwmKA83MqjnKKtUHX8d/HOBRRvH2ll8B0ZK0jyAHVArbcySV4pWaN4xejVg2MGW T2adbCw2C+ekM4D+ESlGcdDazIwTkZqOONmL/mWnqU3ILZBWnYfy6R3UFTQYK/a+chLS HEl+4KbvCDUwKK7X6RI23j/Cva6KbiNZtHgcbKeUjgW3cWFbwPCzPVp29mB96wBSrQbw TDT3HhqLzTeirmt0Ss926nyl99umVNME+opg8nM2Kwr2rVHXYA2akpzkK1XVXn7+VsAs y5AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wwWTusAX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si113421ejt.515.2020.07.08.08.41.41; Wed, 08 Jul 2020 08:42:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wwWTusAX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730378AbgGHPlW (ORCPT + 99 others); Wed, 8 Jul 2020 11:41:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:47668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729858AbgGHPlU (ORCPT ); Wed, 8 Jul 2020 11:41:20 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 445D320786; Wed, 8 Jul 2020 15:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594222880; bh=+LpYrR59OhPiCgCI0Bz36JSXB63Ug5Bm7RsE1ZYQFX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wwWTusAX+B59vR848JVEGG/G3GVKCXLKlLQXX8ksaEXR1undr+mwNOl1XwzJ9FSNv VE4mR6EtV41UtdVgXDeXyZAmS6Cy63U1zhJCmYPY9Wo/QN4khMVmLD63JRpKAHm+lH 66cp17kyHZDdFnI0l8VpX1OesE+6V0THaMlethbI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Krishna Manikandan , Rob Clark , Sasha Levin , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.7 02/30] drm/msm/dpu: allow initialization of encoder locks during encoder init Date: Wed, 8 Jul 2020 11:40:48 -0400 Message-Id: <20200708154116.3199728-2-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200708154116.3199728-1-sashal@kernel.org> References: <20200708154116.3199728-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krishna Manikandan [ Upstream commit 2e7ec6b5297157efabb50e5f82adc628cf90296c ] In the current implementation, mutex initialization for encoder mutex locks are done during encoder setup. This can lead to scenarios where the lock is used before it is initialized. Move mutex_init to dpu_encoder_init to avoid this. Signed-off-by: Krishna Manikandan Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index a1b79ee2bd9d5..aa5409f06e3f9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -2126,7 +2126,6 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc, dpu_enc = to_dpu_encoder_virt(enc); - mutex_init(&dpu_enc->enc_lock); ret = dpu_encoder_setup_display(dpu_enc, dpu_kms, disp_info); if (ret) goto fail; @@ -2141,7 +2140,6 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc, 0); - mutex_init(&dpu_enc->rc_lock); INIT_DELAYED_WORK(&dpu_enc->delayed_off_work, dpu_encoder_off_work); dpu_enc->idle_timeout = IDLE_TIMEOUT; @@ -2186,6 +2184,8 @@ struct drm_encoder *dpu_encoder_init(struct drm_device *dev, spin_lock_init(&dpu_enc->enc_spinlock); dpu_enc->enabled = false; + mutex_init(&dpu_enc->enc_lock); + mutex_init(&dpu_enc->rc_lock); return &dpu_enc->base; } -- 2.25.1