From patchwork Tue May 7 19:14:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 10933623 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5336914B6 for ; Tue, 7 May 2019 19:14:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41EA11FFB1 for ; Tue, 7 May 2019 19:14:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3350C2894E; Tue, 7 May 2019 19:14:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E2F491FFB1 for ; Tue, 7 May 2019 19:14:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED1AE6E829; Tue, 7 May 2019 19:14:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id C3DA36E7D7; Tue, 7 May 2019 19:14:16 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4A18E60A33; Tue, 7 May 2019 19:14:16 +0000 (UTC) Received: from jcrouse1-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id F3D8C609F3; Tue, 7 May 2019 19:14:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F3D8C609F3 From: Jordan Crouse To: freedreno@lists.freedesktop.org Subject: [PATCH] drm/atomic: Check that the config funcs exist drm_mode_alloc Date: Tue, 7 May 2019 13:14:11 -0600 Message-Id: <1557256451-24950-1-git-send-email-jcrouse@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557256456; bh=fOdzMX7nkWBq97wocFIszly8aNfD4psiyZU/x1LQois=; h=From:To:Cc:Subject:Date:From; b=R6OYhfE6g8aa0cZBAnPiB/JFrOV0itf15UMPQ2zQpb1LcYcCqEnPUmXHP+q9q8X/k LOcJCXJzysFIo2NHBF/6jWN+MGz6AP4IJgE4H4WznlEjalc1ls6Wr8iUsuK01+VOdN 8Sb2mqcejGbeKAfbk0WhKQdKBNQnkojsZ148b6Mw= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557256455; bh=fOdzMX7nkWBq97wocFIszly8aNfD4psiyZU/x1LQois=; h=From:To:Cc:Subject:Date:From; b=lWdVLrBN2AlTjCxGhuxp6fugiuSz7j4xPZ5/SC/6JPZ8U8VBYDIfJQQ2CC9xVy0Wl Uxx2hU6ksXcgRdHfkc/HDBUMJyREpm1KoZLSbG8K/hPFGptuzRPc4PfVoNk5vrwWyW OSWFiOm9FHwznwXGv8ixPo8ZckrW1vBm4Qgmz4G8= X-Mailman-Original-Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org X-Mailman-Original-Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Maxime Ripard , Sean Paul MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP An error while initializing the msm driver ends up calling drm_atomic_helper_shutdown() without first initializing the funcs in mode_config. While I'm not 100% sure this isn't a ordering problem in msm adding a check to drm_mode_alloc seems like a nice and safe solution. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/drm_atomic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 5eb4013..1729428 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -114,6 +114,9 @@ drm_atomic_state_alloc(struct drm_device *dev) { struct drm_mode_config *config = &dev->mode_config; + if (!config->funcs) + return NULL; + if (!config->funcs->atomic_state_alloc) { struct drm_atomic_state *state;