From patchwork Sat Jan 3 10:09:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 5561551 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EADF79F2ED for ; Sat, 3 Jan 2015 10:10:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C29820123 for ; Sat, 3 Jan 2015 10:10:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2928E2011D for ; Sat, 3 Jan 2015 10:10:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8919889DBD; Sat, 3 Jan 2015 02:10:02 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTP id 4AC5E89DBD for ; Sat, 3 Jan 2015 02:10:01 -0800 (PST) Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D040AACCC; Sat, 3 Jan 2015 10:10:00 +0000 (UTC) From: Takashi Iwai To: David Airlie Subject: [PATCH v2] drm/radeon: Fix kernel panic with HDMI w/o SAD Date: Sat, 3 Jan 2015 11:09:58 +0100 Message-Id: <1420279798-961-1-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.2.0 Cc: Alex Deucher , christian.koenig@amd.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A BUG_ON() call in dce3_2_afmt_write_sad_regs() is triggered when a HDMI monitor without audio is plugged: kernel BUG at ../drivers/gpu/drm/radeon/dce3_1_afmt.c:110! invalid opcode: 0000 [#1] PREEMPT SMP CPU: 2 PID: 967 Comm: Xorg Tainted: PO 3.16.7-7-desktop #1 Hardware name: System manufacturer System Product Name/M4A77T, BIOS 2401 05/18/2011 task: ffff8800cea86350 ti: ffff8800c1880000 task.ti: ffff8800c1880000 RIP: 0010:[] dce3_1_hdmi_setmode+0x570/0x5a0 [radeon] Call Trace: [] drm_crtc_helper_set_mode+0x346/0x520 [drm_kms_helper] [] drm_crtc_helper_set_config+0x8a8/0xad0 [drm_kms_helper] [] radeon_crtc_set_config+0x3f/0x110 [radeon] [] drm_mode_set_config_internal+0x61/0xe0 [drm] [] restore_fbdev_mode+0xab/0xd0 [drm_kms_helper] [] drm_fb_helper_restore_fbdev_mode_unlocked+0x1e/0x30 [drm_kms_helper] [] drm_fb_helper_set_par+0x22/0x60 [drm_kms_helper] [] drm_fb_helper_hotplug_event+0x8b/0xe0 [drm_kms_helper] [] drm_fb_helper_set_par+0x3a/0x60 [drm_kms_helper] [] fb_set_var+0x15e/0x3b0 [] fbcon_blank+0x1cb/0x2b0 [] do_unblank_screen+0xa1/0x1b0 [] complete_change_console+0x53/0xe0 [] vt_ioctl+0xf49/0x10d0 [] tty_ioctl+0x26c/0xb70 [] do_vfs_ioctl+0x2e7/0x4c0 [] SyS_ioctl+0x81/0xa0 [] system_call_fastpath+0x1a/0x1f [<00007f2fae8c6397>] 0x7f2fae8c6396 Actually the BUG_ON() check is wrong, since sads may be NULL when sad_count is zero. This patch removes the BUG_ON() and adds the proper NULL initialization of sads. Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=911356 Cc: Signed-off-by: Takashi Iwai --- drivers/gpu/drm/radeon/dce3_1_afmt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/dce3_1_afmt.c b/drivers/gpu/drm/radeon/dce3_1_afmt.c index 2fe8cfc966d9..7ca23f45829e 100644 --- a/drivers/gpu/drm/radeon/dce3_1_afmt.c +++ b/drivers/gpu/drm/radeon/dce3_1_afmt.c @@ -72,7 +72,7 @@ static void dce3_2_afmt_write_sad_regs(struct drm_encoder *encoder) struct radeon_device *rdev = encoder->dev->dev_private; struct drm_connector *connector; struct radeon_connector *radeon_connector = NULL; - struct cea_sad *sads; + struct cea_sad *sads = NULL; int i, sad_count; static const u16 eld_reg_to_type[][2] = { @@ -107,7 +107,6 @@ static void dce3_2_afmt_write_sad_regs(struct drm_encoder *encoder) DRM_ERROR("Couldn't read SADs: %d\n", sad_count); return; } - BUG_ON(!sads); for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) { u32 value = 0;