From patchwork Wed Apr 10 17:49:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrik Jakobsson X-Patchwork-Id: 2422581 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 452FADF2E5 for ; Wed, 10 Apr 2013 17:54:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A3F6E6459 for ; Wed, 10 Apr 2013 10:54:02 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BCBBE64AF for ; Wed, 10 Apr 2013 10:50:54 -0700 (PDT) Received: by mail-lb0-f175.google.com with SMTP id o10so810033lbi.34 for ; Wed, 10 Apr 2013 10:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=6qZCetwMyVIBWiLu8hvQo7DVOcad3QYq/uAnhQD94sA=; b=vsOE/XFjrPGHcEzEwDlkotEbEuju0sjSAZORB+j+V989eRd1vjTm2nAV5BTZkvLY4w z6vat2NgjyTP0sj51AqBzUGk1MF4D8XrjjP2FTYGyNNhWa+MC27Hf/TQ8k0wtvHeTcM6 y59Bs+RT1gQuBHcfTGy0FjpLcEVzZHbd7aRmHDByk0ke8PCG5WlVpdU6+hyaRPTl9c81 4QvRDDQyU/hFPmUuEO61/81hQxEcpX7T+4iaiTPX+exXsWn+WHIb0SOGZFXkwLwjEdUf aONdEtB9r50x3YQDFKQQ+fp2EINWGI6WIQEyY+ss13jIfKBj5XwvqM2Ct8kwU9Cu04SI NMrg== X-Received: by 10.152.3.40 with SMTP id 8mr1229937laz.27.1365616253656; Wed, 10 Apr 2013 10:50:53 -0700 (PDT) Received: from patrik-desktop.lan (h138n8-oer-a32.ias.bredband.telia.com. [2.248.103.138]) by mx.google.com with ESMTPS id iq6sm309626lab.10.2013.04.10.10.50.52 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Apr 2013 10:50:53 -0700 (PDT) From: Patrik Jakobsson To: dri-devel@lists.freedesktop.org Subject: [PATCH 03/15] gma500: medfield: Fix possible NULL pointer dereference Date: Wed, 10 Apr 2013 19:49:48 +0200 Message-Id: <1365616200-26312-4-git-send-email-patrik.r.jakobsson@gmail.com> X-Mailer: git-send-email 1.7.10.4 Cc: Syam Sidhardhan , Syam Sidhardhan X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Syam Sidhardhan The use of pointer sender should be after the NULL check. Signed-off-by: Syam Sidhardhan Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c b/drivers/gpu/drm/gma500/mdfld_dsi_output.c index 2d4ab48..3abf831 100644 --- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c +++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c @@ -92,8 +92,8 @@ void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe) { struct mdfld_dsi_pkg_sender *sender = mdfld_dsi_get_pkg_sender(dsi_config); - struct drm_device *dev = sender->dev; - struct drm_psb_private *dev_priv = dev->dev_private; + struct drm_device *dev; + struct drm_psb_private *dev_priv; u32 gen_ctrl_val; if (!sender) { @@ -101,6 +101,9 @@ void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe) return; } + dev = sender->dev; + dev_priv = dev->dev_private; + /* Set default display backlight value to 85% (0xd8)*/ mdfld_dsi_send_mcs_short(sender, write_display_brightness, 0xd8, 1, true);