From patchwork Thu Mar 23 17:04:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 9642171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7A99460327 for ; Fri, 24 Mar 2017 00:37:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C8F728433 for ; Fri, 24 Mar 2017 00:37:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6197E28447; Fri, 24 Mar 2017 00:37:29 +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=-4.2 required=2.0 tests=BAYES_00, 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 B6FF128433 for ; Fri, 24 Mar 2017 00:37:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CAF856EBA7; Fri, 24 Mar 2017 00:36:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from muru.com (muru.com [72.249.23.125]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C2E36EA8F for ; Thu, 23 Mar 2017 17:05:09 +0000 (UTC) Received: from sampyla.muru.com. (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 3E3E281A8; Thu, 23 Mar 2017 17:07:16 +0000 (UTC) From: Tony Lindgren To: Tomi Valkeinen Subject: [PATCH] drm: omapdrm: Fix oops on rmmod Date: Thu, 23 Mar 2017 10:04:59 -0700 Message-Id: <20170323170459.20906-1-tony@atomide.com> X-Mailer: git-send-email 2.11.1 X-Mailman-Approved-At: Fri, 24 Mar 2017 00:36:08 +0000 Cc: linux-omap@vger.kernel.org, Laurent Pinchart , dri-devel@lists.freedesktop.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-Virus-Scanned: ClamAV using ClamSMTP Looks like in Linux next we can now get an oops when unloading omapdrm: Unable to handle kernel NULL pointer dereference at virtual address 00000000 ... LR is at omap_drm_irq_uninstall+0xb0/0xe0 [omapdrm] ... [] (omap_drm_irq_uninstall [omapdrm]) from [] (pdev_remove+0x50/0x88 [omapdrm]) [] (pdev_remove [omapdrm]) from [] (platform_drv_remove+0x24/0x3c) [] (platform_drv_remove) from [] (device_release_driver_internal+0x160/0x1f4) [] (device_release_driver_internal) from [] (driver_detach+0x38/0x6c) [] (driver_detach) from [] (bus_remove_driver+0x4c/0xa0) [] (bus_remove_driver) from [] (platform_unregister_drivers+0x24/0x30) [] (platform_unregister_drivers) from [] (SyS_delete_module+0x150/0x218) [] (SyS_delete_module) from [] (ret_fast_syscall+0x0/0x1c) Fix the issue by checking get_vblank_counter() before trying to call it. Signed-off-by: Tony Lindgren --- drivers/gpu/drm/omapdrm/omap_irq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c --- a/drivers/gpu/drm/omapdrm/omap_irq.c +++ b/drivers/gpu/drm/omapdrm/omap_irq.c @@ -303,8 +303,9 @@ void omap_drm_irq_uninstall(struct drm_device *dev) for (i = 0; i < dev->num_crtcs; i++) { wake_up(&dev->vblank[i].queue); dev->vblank[i].enabled = false; - dev->vblank[i].last = - dev->driver->get_vblank_counter(dev, i); + if (dev->driver->get_vblank_counter) + dev->vblank[i].last = + dev->driver->get_vblank_counter(dev, i); } spin_unlock_irqrestore(&dev->vbl_lock, irqflags); }