From patchwork Fri Oct 26 10:05:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 10657177 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 5D36B109C for ; Fri, 26 Oct 2018 10:07:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4119F2B22A for ; Fri, 26 Oct 2018 10:07:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 322F92C474; Fri, 26 Oct 2018 10:07:03 +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,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,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 B543E2B22A for ; Fri, 26 Oct 2018 10:07:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 961246E43C; Fri, 26 Oct 2018 10:07:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 069306E43C for ; Fri, 26 Oct 2018 10:07:00 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id i17-v6so679968wre.7 for ; Fri, 26 Oct 2018 03:06:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/wDV+A7ZUF2+KbKXXntaKusEZ4oYRhZYnssGeIgfsgY=; b=e6MNebhdOKAuyaWNKIK9lHJHq9ajhEhvmHErEPh7FOM7+q95tB5etxJyeomEFPF7n1 UGnjbQoDtcm2BPT/CxrmJIw1CipSQDX9o71V1tbOl9qCUA2AK1GJLZDVSYWhPV6Iy53v uvdkIuWHCihgX09Y329gniE/GdCvb5eVKdqpRYXuBksXTVtAUsGsjUGTx//SnFUzySLN p+5dk33d9PoVWUT4106au3XgFyUicYQgCNJ4v3Kv9q++UdUJZLyXv27eJYtCSl+WU6rO oeZjYY8FHOaeHGHNMuW9RpfTs4qoZ3ZqLigmDOFuLP/UDu8oXsrfMWR7wamUiyI+CuBL mC0w== X-Gm-Message-State: AGRZ1gJmhM4H5x0Fq66bKL/pp7BuSNv7/Y0v2WeMWdQ3Op9hq1yPE0gS ft8LEJdgcdrMJ7PWEG8PvowOWV1F X-Google-Smtp-Source: AJdET5fhtLQZnMvmn4mbwNVoas3BS6kzM+h80aQkDUSykyLX9ZCYHz/OCh5YUjnxvOPOXpomLTcEBA== X-Received: by 2002:adf:ee52:: with SMTP id w18-v6mr5153705wro.63.1540548418441; Fri, 26 Oct 2018 03:06:58 -0700 (PDT) Received: from arch-x1c3.cbg.collabora.co.uk ([2a00:5f00:102:0:9665:9cff:feee:aa4d]) by smtp.gmail.com with ESMTPSA id b15-v6sm393373wrr.90.2018.10.26.03.06.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 03:06:57 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/vkms: provide a parent device to drm_dev_init() Date: Fri, 26 Oct 2018 11:05:50 +0100 Message-Id: <20181026100550.625-1-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 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: Deepak Sharma , Haneen Mohammed , Rodrigo Siqueira , Maxime Ripard , Daniel Vetter , emil.l.velikov@gmail.com, Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Emil Velikov Earlier commit updated the vgem driver to improve the topology, by passing a platform device as parent to drm_dev_init(). Shortly afterwords we updated the core function to BUG() in order to catch any buggy drivers passing NULL as parent. While I missed the vkms driver (as the patch predates vkms by a few months), the BUG caught the issue within couple of hours. Swap the drm_dev_init <> platform_device_register_simple order, to the driver back to life. Fixes: f08877e79485 ("drm: BUG_ON if passing NULL parent to drm_dev_init") Cc: Daniel Vetter Cc: Deepak Sharma Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: Haneen Mohammed Cc: Rodrigo Siqueira Reported-by: Daniel Vetter Signed-off-by: Emil Velikov Reviewed-by: Daniel Vetter --- Rodrigo, Haneen, my plan is to push the patch to the drm-misc tree. An Ack/Rb will be appreciated. Thanks Emil --- drivers/gpu/drm/vkms/vkms_drv.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 07cfde1b4132..a3d57e0f5ee5 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -108,17 +108,18 @@ static int __init vkms_init(void) if (!vkms_device) return -ENOMEM; - ret = drm_dev_init(&vkms_device->drm, &vkms_driver, NULL); - if (ret) - goto out_free; - vkms_device->platform = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); if (IS_ERR(vkms_device->platform)) { ret = PTR_ERR(vkms_device->platform); - goto out_fini; + goto out_free; } + ret = drm_dev_init(&vkms_device->drm, &vkms_driver, + &vkms_device->platform->dev); + if (ret) + goto out_unregister; + vkms_device->drm.irq_enabled = true; ret = drm_vblank_init(&vkms_device->drm, 1); @@ -129,20 +130,20 @@ static int __init vkms_init(void) ret = vkms_modeset_init(vkms_device); if (ret) - goto out_unregister; + goto out_fini; ret = drm_dev_register(&vkms_device->drm, 0); if (ret) - goto out_unregister; + goto out_fini; return 0; -out_unregister: - platform_device_unregister(vkms_device->platform); - out_fini: drm_dev_fini(&vkms_device->drm); +out_unregister: + platform_device_unregister(vkms_device->platform); + out_free: kfree(vkms_device); return ret;