Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3097868ybi; Thu, 18 Jul 2019 20:59:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWsevC92LRh+wqg5avkbvTbnb5H7O7biqUzHqnCzlzlwwFFpmYI8WnbzhjN+5td5EmwO/g X-Received: by 2002:a65:6495:: with SMTP id e21mr52201026pgv.359.1563508797855; Thu, 18 Jul 2019 20:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563508797; cv=none; d=google.com; s=arc-20160816; b=dkZLl0UyHUW3YvZ7nLJpgsLmSNzXsUDnNKN53pttbXvU3pcaK6V8ABeYiLCDFTCrCF D8stmWWIAJe9XE+TDGaE5CplP7WMyDshmZso81AHgipAPXjpGUIt3/ND33ndKDkPlsmw fahC1HpLzeP9CU9ZrQy2Ohc3Q9y3zZmJKrVrEGi8P0hhSNwT3ht4deq+045UOPPsCs7k A6D9WULrIVwS4d+SWd9pGbmX0H7M14Kx6S9zLObhAa0+2YSoD0G4W/7gYu/9Ipx5FxY8 Ve44keo4ipcqcPQ1U0w3TLjukis37YpDP3QAdfc4r2wV2Oawlg7FSIOcvJd1vkqvSQWl FivA== 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=vVgj12AVcjA6W35Xcw+Ecec3xkjhQFrT7KWMg0+sOAg=; b=KQO47MAgfILi2q59mebmUYyY6Vu+Ud8dznDkOUUwWEGirOcIVAlSKidD1a3AXvpl62 X6fzQm5/hnCS+IFbt5RtGybc2FwE6xGpImmzwiPJ93lGkXq0cdq0ppw/EfI4RotSv0u1 uICvI5iUB9bzfXVkNXHAKZHyEN69zDnwG57ltC3osWfWJahHX3KoF4yj+40GTDvvKMkb UcNjrLOAqdS/xCGWNNQTtwxwFwUMZI9co+XxC+FGvqwxssgn2fjVwAxC0bW8v38p+ouz WzeMqfVJIG8HdBEatOJtyjlOKXL8o2ZfxwszKMXshTXTy5vZhFTeJlnIVNkVF+rdSym3 ocdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mzxn2vBf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id m45si643073pje.39.2019.07.18.20.59.42; Thu, 18 Jul 2019 20:59:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mzxn2vBf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728273AbfGSD6o (ORCPT + 99 others); Thu, 18 Jul 2019 23:58:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:58124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728216AbfGSD6n (ORCPT ); Thu, 18 Jul 2019 23:58:43 -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 75E282186A; Fri, 19 Jul 2019 03:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508722; bh=mGJjLnQQ/4+ObCoHaIBDqw4yszwDJRupU01Ku3dNIhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzxn2vBf2w0AUmLD4P8tZeIzZomSIkRr4afGK97axqzwzoDGWLv+K59Q/z63D84jG Y3c2X+0Qf6SM+haWy9A7zb4Co1AemQ3lL14lqLRGRvyLpdrdd0CPEbBFIJZh0q+c6y v2ka0A5bQEy71lNe0BRdado6u6dNZ9y6uXdD6WV4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nicholas Kazlauskas , Leo Li , Alex Deucher , Sasha Levin , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.2 052/171] drm/amd/display: Always allocate initial connector state state Date: Thu, 18 Jul 2019 23:54:43 -0400 Message-Id: <20190719035643.14300-52-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-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: Nicholas Kazlauskas [ Upstream commit f04bee34d6e35df26cbb2d65e801adfd0d8fe20d ] [Why] Unlike our regular connectors, MST connectors don't start off with an initial connector state. This causes a NULL pointer dereference to occur when attaching the bpc property since it tries to modify the connector state. We need an initial connector state on the connector to avoid the crash. [How] Use our reset helper to allocate an initial state and reset the values to their defaults. We were already doing this before, just not for MST connectors. Signed-off-by: Nicholas Kazlauskas Reviewed-by: Leo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 0e482349a5cb..dc3ac66a4450 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4627,6 +4627,13 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, { struct amdgpu_device *adev = dm->ddev->dev_private; + /* + * Some of the properties below require access to state, like bpc. + * Allocate some default initial connector state with our reset helper. + */ + if (aconnector->base.funcs->reset) + aconnector->base.funcs->reset(&aconnector->base); + aconnector->connector_id = link_index; aconnector->dc_link = link; aconnector->base.interlace_allowed = false; @@ -4809,9 +4816,6 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm, &aconnector->base, &amdgpu_dm_connector_helper_funcs); - if (aconnector->base.funcs->reset) - aconnector->base.funcs->reset(&aconnector->base); - amdgpu_dm_connector_init_helper( dm, aconnector, -- 2.20.1