From patchwork Sat Nov 25 20:50:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10075117 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 2650A60383 for ; Sat, 25 Nov 2017 20:50:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1613028A9D for ; Sat, 25 Nov 2017 20:50:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07AA828E49; Sat, 25 Nov 2017 20:50:27 +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 692A928E47 for ; Sat, 25 Nov 2017 20:50:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 172AE6E164; Sat, 25 Nov 2017 20:50:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [212.227.17.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 99F676E164 for ; Sat, 25 Nov 2017 20:50:23 +0000 (UTC) Received: from [192.168.1.3] ([92.228.138.71]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Martm-1eYaOS4BLe-00KPxA; Sat, 25 Nov 2017 21:50:15 +0100 Subject: [PATCH 5/5] video: smscufx: Adjust three checks for null pointers From: SF Markus Elfring To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Bartlomiej Zolnierkiewicz , Steve Glendinning References: Message-ID: <0c4fc190-122a-6a46-2dcc-a17b4acd84b5@users.sourceforge.net> Date: Sat, 25 Nov 2017 21:50:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:i4LwJ8o/6h9VaFhnq1Sb0cJ/L9lgiJtSt0qscJxml0XoWHu4bWa uBRaJ9fxnJDMYXL3XFlJiCzLxQxFi4v/ikgi65qmY/hSMTPfXl6CXjP78YBCF6A8SMUnnI/ J0Q5S3jjYV5FCjILIyRBLPGaNFXPHTcWzPmXBCOmnlrggAzGsZ+ZaClmd8aYv76CLwmgpIh JXp92QF6aSaQ7aA2VT2GQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:vn5ZQ4WaXS8=:O5bRbgk5m44XptsU4uSK1Q 6ar93K66YkWUlxmEhNy4x0N2kI06oJF0iHsmcJ0ZxFDROALTr8/u0jerJv2eihetD5lO3NNo8 rTiZ2xgge+XW9uKfHceW9IHXPCDCC2+O5PWRZQkQqbcnyADFzu9Lmiv+djDcCWhZzRYgzooME Jins6D7OuRMkXDPZnMAOWF0opQClAdwUPZtzplRGDGlvAir7FUHY8nYfP8pYyqpzt20o6Ugt0 4ukPwo6JOU8jUwmIbd2m66ZvRgD3ynoNsT0R4u8eaXcIJb+GYnTgz2Ibk1IwmUhJdyB0P3fhC NsgOfzuElywA/OoG+plTuHDo3V2PP1pY2jNYO9lqNSWBGcWMO1ppbZY1jPpc6Vbd8mEdPNgac 83fc471HVjmChf9uqDdJH6+MabSP6InCu6zBO8sqFmraIoa7RKGHrIbuLcUCZFteN8fNi96+Q vFHAkiWAVBi0ilSL9pDPIE3O7vkgSqRzl9aqbb3T8GhjapP9bamLztHUDXB/mEKGXDAgCDrZr YyhG4JqRHQ18w7f2+cl2qjk0+zwf62vAokqONwhV9ys99i/AFoapPjOCW9sb8/DZaeJWF4e/3 nRKAcriI9Q+E/mxz5rImJf3HcC1WxM/W958wGD3RJVffWXxMYcC/ae15YDZIkIIu/ejTpvF8c c+E3JQYulmDZra9oQnjHz8uvoYsXZK6hoooOzZ9iU4tnpxAc3BEf6PtvfonI/jUM/5edkySGH QabQmAA/KUvL0D6Ub4lH/1g3EbHUL9DrMevdVxiFok7+xKM6dNcnhOwS9DSU4r3QQOjVSAc0i fIJN4nP2/dHYev9vXMmPH8OG+XipaZF3KV8yVJpcCbiHV/CZ4A= Cc: kernel-janitors@vger.kernel.org, LKML 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 25 Nov 2017 21:21:20 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script “checkpatch.pl” pointed information out like the following. Comparison to NULL could be written … Thus fix the affected source code places. Signed-off-by: Markus Elfring --- drivers/video/fbdev/smscufx.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c index 03d35429e1b9..d14604536e63 100644 --- a/drivers/video/fbdev/smscufx.c +++ b/drivers/video/fbdev/smscufx.c @@ -1081,7 +1081,7 @@ static int ufx_ops_open(struct fb_info *info, int user) kref_get(&dev->kref); - if (fb_defio && (info->fbdefio == NULL)) { + if (fb_defio && !info->fbdefio) { /* enable defio at last moment if not disabled by client */ struct fb_deferred_io *fbdefio; @@ -1556,8 +1556,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info, } /* If everything else has failed, fall back to safe default mode */ - if (default_vmode == NULL) { - + if (!default_vmode) { struct fb_videomode fb_vmode = {0}; /* Add the standard VESA modes to our modelist @@ -1583,8 +1582,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info, } /* If we have good mode and no active clients */ - if ((default_vmode != NULL) && (dev->fb_count == 0)) { - + if (default_vmode && dev->fb_count == 0) { fb_videomode_to_var(&info->var, default_vmode); ufx_var_color_format(&info->var); @@ -1594,10 +1592,9 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info, (info->var.bits_per_pixel / 8); result = ufx_realloc_framebuffer(dev, info); - - } else + } else { result = -EINVAL; - + } error: if (edid && (dev->edid != edid)) kfree(edid);