From patchwork Mon Aug 28 11:16:21 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: 9925323 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 38E3960375 for ; Mon, 28 Aug 2017 11:16:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EC13286B8 for ; Mon, 28 Aug 2017 11:16:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23B75286BC; Mon, 28 Aug 2017 11:16:45 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0B96286B8 for ; Mon, 28 Aug 2017 11:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751230AbdH1LQb (ORCPT ); Mon, 28 Aug 2017 07:16:31 -0400 Received: from mout.web.de ([212.227.17.12]:50388 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbdH1LQ3 (ORCPT ); Mon, 28 Aug 2017 07:16:29 -0400 Received: from [192.168.1.2] ([78.48.87.233]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LZeZU-1d7PqM1AhY-00lSYI; Mon, 28 Aug 2017 13:16:22 +0200 Subject: [PATCH 3/3] [media] Siano: Adjust five checks for null pointers From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: <386b5a60-548e-1896-5271-4875fa2aea94@users.sourceforge.net> Message-ID: <2000da6b-ca21-18a1-dc04-d2b127084153@users.sourceforge.net> Date: Mon, 28 Aug 2017 13:16:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <386b5a60-548e-1896-5271-4875fa2aea94@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:t6ZPcRTroL0kEf1L7h44qqb6KTntAQe+c0vLcB2zwgpy0xu3gDA bsz8gWO2jOWD4cRd1xY39WKNk710T0+0P6T+7crpSXjyBklPvKRI+M7+KijpC33ulvvgMwW Ac3gky2oVNRUaCuU1TpRjQZKy87GHuPPKKZq+qL9eh6XCJY8rhru1V1K4StG9T/cBOnyuXp Z8IxTYcLwD1trzeBHl2zQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:r7NunpTihuI=:LGBbIhnHxBAeR8VK/z+mPY auu8vLGfxYStqVFNKFd8qVqxt1aalGx6M6ZMhenhKhvLZuyydLWok9fjkpj0yV3slay5T3E32 bJ+Eenl/Eb9A2olr8Y8fKSnLSJgdBebQlZI88PlHmrIYjsMmX3UAialL6zt01THP65hr53wn5 8MoKREUYps1uFQir8Ugfw0oZIp+yJFGa0+MFsK84JqRY8Il4FyEWGEqElQR7NgNDR7LhulZpw NH0awcpxFkc/EgeI2SvWjQsjzR+NQ0kObVINx93fXRXsyWclCdBpBr3TRmb7S40egT1glgwnQ 9z5jrN1xvDnf2wWPala8L4dn2XoXoEImOLLRanc0iZwPfpZU4tuArhg9GBuuN2xrGGHBCQ4n1 aa5y4m6TqDQ14QNDUIipjToob6EcPquo7XKiXRicAvpb/mljp8av0FPq8vY31n90TPbqwcjvU iOGiSX2koe7KLxdOYQxacZGueF0mvXuH5DougV5do7xJPKZnn1AsUGsBMslKOO75JiAJrNXOp XTO+8c3L2NvjFDe8f0/QWZIzQNWNW3yRDE4mFUmlNKVc2qYIV+QIKUmjlaR9ODG0B2tWTXiMd IgR/gqBIqHnKKSGpX7dsRlBUEoPre/bHQW9E6kj+lGhoopORrrJ+OyihpFycE34AaWHOAwzHO knI+I45qVRhM9qZj4sJHFvwfZVQQGLBVmQcRjtlt8K/U8DlcnVGTROxFt9xy0BjOpIlR6au7w 4NidThuzf1eqL/D/zblwRXI7A7qi3/z+AHZy7IujY5UYPJJ0snDcM7lLZrUlT4B3UVWJvfX+V 1CdzGzH3cRA/aZFbYHLYmfeSNs6d6Gzab4wIrt1S6w54ZK6fEg= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 28 Aug 2017 12:50:28 +0200 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/media/common/siano/smscoreapi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c index ad1c41f727b1..e4ea2a0c7a24 100644 --- a/drivers/media/common/siano/smscoreapi.c +++ b/drivers/media/common/siano/smscoreapi.c @@ -749,7 +749,7 @@ static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, void *buffer, size_t size, struct completion *completion) { int rc; - if (completion == NULL) + if (!completion) return -EINVAL; init_completion(completion); @@ -1151,8 +1151,8 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, } pr_debug("Firmware name: %s\n", fw_filename); - if (loadfirmware_handler == NULL && !(coredev->device_flags - & SMS_DEVICE_FAMILY2)) + if (!loadfirmware_handler && + !(coredev->device_flags & SMS_DEVICE_FAMILY2)) return -EINVAL; rc = request_firmware(&fw, fw_filename, coredev->device); @@ -1789,7 +1789,7 @@ int smsclient_sendrequest(struct smscore_client_t *client, struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) buffer; int rc; - if (client == NULL) { + if (!client) { pr_err("Got NULL client\n"); return -EINVAL; } @@ -1797,7 +1797,7 @@ int smsclient_sendrequest(struct smscore_client_t *client, coredev = client->coredev; /* check that no other channel with same id exists */ - if (coredev == NULL) { + if (!coredev) { pr_err("Got NULL coredev\n"); return -EINVAL; } @@ -1954,7 +1954,7 @@ int smscore_gpio_configure(struct smscore_device_t *coredev, u8 pin_num, if (pin_num > MAX_GPIO_PIN_NUMBER) return -EINVAL; - if (p_gpio_config == NULL) + if (!p_gpio_config) return -EINVAL; total_len = sizeof(struct sms_msg_hdr) + (sizeof(u32) * 6);