drm/i915/display: Remove useless but deadly local
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 26 Mar 2020 08:28:38 +0000 (08:28 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 26 Mar 2020 11:22:06 +0000 (11:22 +0000)
Beware dereferencing the NULL pointer prior to checking for its
existence.

<1>[    3.324694] BUG: kernel NULL pointer dereference, address: 0000000000000000
<1>[    3.324696] #PF: supervisor read access in kernel mode
<4>[    3.324704] hardirqs last  enabled at (751): [<ffffffff812a4f77>] d_lookup+0x57/0xa0
<1>[    3.324709] #PF: error_code(0x0000) - not-present page
<4>[    3.324716] hardirqs last disabled at (752): [<ffffffff8125a1b9>] __slab_alloc.isra.89.constprop.94+0x19/0x70
<4>[    3.324720] softirqs last  enabled at (402): [<ffffffff81e00385>] __do_softirq+0x385/0x47f
<6>[    3.324725] PGD 0 P4D 0
<4>[    3.324733] softirqs last disabled at (395): [<ffffffff810bab6a>] irq_exit+0xba/0xc0
<4>[    3.324762] Oops: 0000 [#1] PREEMPT SMP PTI
<4>[    3.324768] CPU: 0 PID: 380 Comm: systemd-udevd Not tainted 5.6.0-rc7-CI-CI_DRM_8189+ #1
<4>[    3.324776] Hardware name: MSI MS-7924/Z97M-G43(MS-7924), BIOS V1.12 02/15/2016
<4>[    3.324840] RIP: 0010:intel_read_infoframe+0x3a/0x170 [i915]
<4>[    3.324848] Code: 65 48 8b 04 25 28 00 00 00 48 89 44 24 20 31 c0 83 f9 0a 77 12 ba 01 00 00 00 48 d3 e2 f7 c2 c0 05 00 00 48 0f 45 c7 83 fb 03 <4c> 8b 20 0f 84 f2 00 00 00 83 fb 0a 0f 84 f3 00 00 00 83 fb 07 0f
<4>[    3.324865] RSP: 0018:ffffc900005438b0 EFLAGS: 00010212
<4>[    3.324871] RAX: 0000000000000000 RBX: 0000000000000082 RCX: 0000000000000001
<4>[    3.324879] RDX: 0000000000000002 RSI: ffff8883f8309000 RDI: ffff8883f80cbe00
<4>[    3.324887] RBP: ffff8883f8309b34 R08: 000000000000000e R09: 0000000000000001
<4>[    3.324894] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8883f7ac0000
<4>[    3.324901] R13: ffff8883f7ac0000 R14: ffff8883f7ac0d90 R15: ffff8883f844d000
<4>[    3.324908] FS:  00007ffa4a839680(0000) GS:ffff888410000000(0000) knlGS:0000000000000000
<4>[    3.324917] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
<4>[    3.324923] CR2: 0000000000000000 CR3: 0000000401aa4002 CR4: 00000000001606f0
<4>[    3.324930] Call Trace:
<4>[    3.324980]  ? gen6_read32+0x272/0x300 [i915]
<4>[    3.325044]  intel_ddi_get_config+0x238/0x610 [i915]
<4>[    3.325108]  hsw_crt_get_config+0x12/0x40 [i915]
<4>[    3.325173]  intel_modeset_setup_hw_state+0x3b3/0x1660 [i915]
<4>[    3.325182]  ? ww_mutex_lock+0x39/0x70
<4>[    3.325190]  ? drm_modeset_lock+0xad/0x120
<4>[    3.325254]  intel_modeset_init+0x582/0x1c50 [i915]

Fixes: 419190429cd1 ("drm/i915/hdmi: use struct drm_device based logging")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Wambui Karuga <wambui.karugax@gmail.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200326082838.16357-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/display/intel_hdmi.c

index 395dc19..0076abc 100644 (file)
@@ -691,7 +691,6 @@ void intel_read_infoframe(struct intel_encoder *encoder,
                          union hdmi_infoframe *frame)
 {
        struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
-       struct drm_i915_private *i915 = to_i915(intel_dig_port->base.base.dev);
        u8 buffer[VIDEO_DIP_DATA_SIZE];
        int ret;
 
@@ -708,13 +707,13 @@ void intel_read_infoframe(struct intel_encoder *encoder,
        /* see comment above for the reason for this offset */
        ret = hdmi_infoframe_unpack(frame, buffer + 1, sizeof(buffer) - 1);
        if (ret) {
-               drm_dbg_kms(&i915->drm,
+               drm_dbg_kms(encoder->base.dev,
                            "Failed to unpack infoframe type 0x%02x\n", type);
                return;
        }
 
        if (frame->any.type != type)
-               drm_dbg_kms(&i915->drm,
+               drm_dbg_kms(encoder->base.dev,
                            "Found the wrong infoframe type 0x%x (expected 0x%02x)\n",
                            frame->any.type, type);
 }