From patchwork Wed Jul 23 14:28:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Jakobi X-Patchwork-Id: 4611161 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F022F9F2B8 for ; Wed, 23 Jul 2014 14:28:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 690C720179 for ; Wed, 23 Jul 2014 14:28:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 882BB20170 for ; Wed, 23 Jul 2014 14:28:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CBD936E464; Wed, 23 Jul 2014 07:28:28 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F6AC6E464 for ; Wed, 23 Jul 2014 07:28:26 -0700 (PDT) Received: from [129.70.15.110] by 3capp-gmx-bs69.server.lan (via HTTP); Wed, 23 Jul 2014 16:28:16 +0200 MIME-Version: 1.0 Message-ID: From: "Tobias Jakobi" To: "Tobias Jakobi" Subject: Aw: [PATCH] drm/exynos: g2d: let exynos_g2d_get_ver_ioctl fail Date: Wed, 23 Jul 2014 16:28:16 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <1406123832-7026-1-git-send-email-tjakobi@math.uni-bielefeld.de> References: <1406123832-7026-1-git-send-email-tjakobi@math.uni-bielefeld.de> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K0:GzhWAMJOlFQCpVGjZ4tk30NXxmQUmMZ8NLZJvi2Z05y LLiep28b5Y86bSrhbXx9jbqLF4BYD2D4b40HAEqEgKoGM+elWS xE8IYxdOPwpbkr17m8+cy8vDvqdGakEQQlEBgo1vt5hqMZIjDi EKil0J/j6FWG11mzXBxoaqXFERS7Ir19O8svDUyDOvydrvO8KB qWeFE9W4OzJkXObbsiLpyg2os26AxzccWA7hq4YqDKzBoJc9pP 89EMnOfb+tlE2dSQY3U4XG2cEDnBPUhxVf5HLI5D1ISMmnvGJJ ssmRjY= Cc: Tobias Jakobi , linux-samsung-soc@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, 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 Sorry for the noise! Please disregard the patch for now, it causes more trouble than it solves! - Tobias   Gesendet: Mittwoch, 23. Juli 2014 um 15:57 Uhr Von: "Tobias Jakobi" An: linux-samsung-soc@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, t.figa@samsung.com, inki.dae@samsung.com, "Tobias Jakobi" Betreff: [PATCH] drm/exynos: g2d: let exynos_g2d_get_ver_ioctl fail Currently the DRM_IOCTL_EXYNOS_G2D_GET_VER ioctl always succeeds, even if no G2D support is available. Let the ioctl fail when this is the case, so that userspace can accurately probe for G2D support. This also fixes the exynos tests in libdrm. There 'g2d_init' doesn't fail when G2D is absent, leading to a segfault later. Signed-off-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 1.8.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 5fa1bb6..cde8a89 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -1042,8 +1042,19 @@ err: int exynos_g2d_get_ver_ioctl(struct drm_device *drm_dev, void *data, struct drm_file *file) { + struct drm_exynos_file_private *file_priv = file->driver_priv; + struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; + struct device *dev = g2d_priv->dev; + struct g2d_data *g2d; struct drm_exynos_g2d_get_ver *ver = data; + if (!dev) + return -ENODEV; + + g2d = dev_get_drvdata(dev); + if (!g2d) + return -EFAULT; + ver->major = G2D_HW_MAJOR_VER; ver->minor = G2D_HW_MINOR_VER;