Received: by 10.223.176.46 with SMTP id f43csp2151297wra; Sun, 21 Jan 2018 12:31:47 -0800 (PST) X-Google-Smtp-Source: AH8x224hZg4IbcJ6mLFeR773AHYmNPoPbq0fqDqsFqgj50Ov82w/Pn5M5GVdYyoDCX6azsx8AfZQ X-Received: by 10.98.31.131 with SMTP id l3mr6242010pfj.116.1516566707110; Sun, 21 Jan 2018 12:31:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516566707; cv=none; d=google.com; s=arc-20160816; b=tfLsmWONspGwD2+vd7XbewQ+oE7m0EoU44xNi8lQHHbDlMVqCt2euzMLBbDtW9+Pzb MQBsUwanYEgHOxlrNo/WDQU86kTFLDuCx4FnCZ5V4XwpTKZW4vwhI/BJ37Vv7Kght6Jz fRoAneXMSo2CG8I4vt6aSQ9l2HQdBSbIhL4v79uIllk6JjWejiqRCDDaWrTLCPF1L2WE 6eAveXV5p3rGoTI8DoIYkkT5srt7Eqvi+ULbzkhgzI/p5DPyJ09WO22hEaJt4cGYSbea iramgPAQg56Jrn95wtETLjL3zO4aculbhEsp9xmM6UUdEEUCJjDMYmAts0WdyleqB7+r a9Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:arc-authentication-results; bh=jgMy2hpjL9PlZd0kr/N/n9dutHjKCuI8HyNnG3Kg2Sw=; b=lctNhceq8UObj+bf8uftUN6+FoweA2MGlm96rHc7euuKxwqR89nJ7Yot1pvbo2r9oD WXIPZ5CKqt/9OGN9T3pnXj6BO2GhK7fFl+jv58dMILazNA1fQbHqUJHOoClmQ/cHgAMe Yso5bYXgrC0uWTlBifV3v7KazuEG680i01OiHMQmqtB1GqlLiaohfvp/h6rygwz5Wjy0 z4bf8qqSftWtjwGaX98N6ahZNoNpEC1XrjMR5OD+OPBz/S6+Vkgnps/LcB5wn+OPif/G xfoer10XRMKcO5s5zYkjMj4IiSjEIeqF90qZhTxLh6J6Gh9eev/0eFdBhb+zNuER05MC FOgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si14056612pfd.257.2018.01.21.12.31.33; Sun, 21 Jan 2018 12:31:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751149AbeAUUa0 (ORCPT + 99 others); Sun, 21 Jan 2018 15:30:26 -0500 Received: from mout.web.de ([217.72.192.78]:51440 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750951AbeAUUaY (ORCPT ); Sun, 21 Jan 2018 15:30:24 -0500 Received: from [192.168.1.3] ([77.181.34.161]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LpfC6-1fGG2X2m3i-00fPBr; Sun, 21 Jan 2018 21:30:19 +0100 Subject: [PATCH 3/3] Input: cyttsp4_core: Adjust 13 checks for null pointers From: SF Markus Elfring To: linux-input@vger.kernel.org, Dmitry Torokhov , Ferruh Yigit Cc: LKML , kernel-janitors@vger.kernel.org References: <61183426-0b2a-4b93-933c-a2dfd487d92b@users.sourceforge.net> Message-ID: <6c4f8970-11bd-fe4c-1041-48a006b98b15@users.sourceforge.net> Date: Sun, 21 Jan 2018 21:30:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <61183426-0b2a-4b93-933c-a2dfd487d92b@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:aMQjsNxANL93JPQAjGG99OaUm8mo8fsowpKDVfFo+drTetTztzW uF75sdj/4VrEfh6iIX3Kj0hOTE6r3/1HLNeY7fVIoUr8m7uaefvdAe3I6t/xRo+q3VLndxw BWjOfnubTgRBE2edWJ62HdtlRmTUrzAGiQ9LLVFxnTYaD8oyySWdEWkChDLfvQD3iCtnLHF 6dbVN96DE+zkB/hwBNBgQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:LYmOyGHE7+I=:87rVMW+5c61coC2phQw7wX Ce/EmCqSWQiyoocPs1wG5/PAGxZ880bLxjwTpBjoFect94BiqcQYiBA92PYfF/9mm3nbcDCti tWM4dzfg7N+iCBDpPztN8hGTC1ZM7eGaOFk95LXNgxLt+4rOyi6fHZYNTAy90cM3mEsFfqwvf 60fFKCBlI/g/vWK1jpUctOoGuB+yY063a5+FE5V8KyXQ38HfQ8BZXOBtlDMJ5lravR6lm+lYw ZOI6jKeK+KrycePRpqTc68vehqz2jb5PvlPTr/RKV8fcMqUl9uOdcKueEF3UaiQFyTfM66Gqu sJam2WNZ+D2xiEkXXzzKyXRE9eOEdCOB47SpesqaVPCwvyzd3HIFR96tNjUth59K/i0VN/lhx nDwQSk+ZYue+XIU7Xdfel18uNMkfY9YWBznL/b11EC12y2tqbAK+NqsBK5Vxo9rS6JiF1XnkL aTieh4ZX3vndmtoGXko+A7Yw/QEJBUstfjqYDA40Gi/lhfYHXLlSQxgxSO5Qhz/zEsL0Dw8IY DFxucT3DhCWL9LCe0Re6IwCKb62WUJqA8Wr8nDEH/A4eBF2HmfYm5o8eoiEgU7AOR2kMF9QC7 dqoZA3kZexyk26UVkt9WutnvPpI6gggrV4dPljkRqIYYiElpprBKJE1qaB1FddHBP1/0z4FVG p8B/lPa7U0QOFooKEg0BEOvBRTf/BBRVC5byLHEitiJG04IeuHuvKkrKn5QORsjtsatcVwRC8 nfgJ57ogrtRQIOqPzmlZTtR7v5tcp8aspKj5aUOiFjJflnwrXOYSwxeeZrv0Wfj5xx1J17b6J GPzCmekpqjCUbvEPZa/tTP2ry5aW8iy6bMr59BTHKforMALmGk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Sun, 21 Jan 2018 21:15:11 +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/input/touchscreen/cyttsp4_core.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index 35f48b66ff36..32a4a45554fe 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -213,7 +213,7 @@ static int cyttsp4_si_get_cydata(struct cyttsp4 *cd) si->si_ofs.cydata_size); p = krealloc(si->si_ptrs.cydata, si->si_ofs.cydata_size, GFP_KERNEL); - if (p == NULL) { + if (!p) { dev_err(cd->dev, "%s: failed to allocate cydata memory\n", __func__); return -ENOMEM; @@ -288,7 +288,7 @@ static int cyttsp4_si_get_test_data(struct cyttsp4 *cd) si->si_ofs.test_size = si->si_ofs.pcfg_ofs - si->si_ofs.test_ofs; p = krealloc(si->si_ptrs.test, si->si_ofs.test_size, GFP_KERNEL); - if (p == NULL) { + if (!p) { dev_err(cd->dev, "%s: failed to allocate test memory\n", __func__); return -ENOMEM; @@ -347,7 +347,7 @@ static int cyttsp4_si_get_pcfg_data(struct cyttsp4 *cd) si->si_ofs.pcfg_size = si->si_ofs.opcfg_ofs - si->si_ofs.pcfg_ofs; p = krealloc(si->si_ptrs.pcfg, si->si_ofs.pcfg_size, GFP_KERNEL); - if (p == NULL) { + if (!p) { dev_err(cd->dev, "%s: failed to allocate pcfg memory\n", __func__); return -ENOMEM; @@ -399,7 +399,7 @@ static int cyttsp4_si_get_opcfg_data(struct cyttsp4 *cd) si->si_ofs.opcfg_size = si->si_ofs.ddata_ofs - si->si_ofs.opcfg_ofs; p = krealloc(si->si_ptrs.opcfg, si->si_ofs.opcfg_size, GFP_KERNEL); - if (p == NULL) { + if (!p) { dev_err(cd->dev, "%s: failed to allocate opcfg memory\n", __func__); return -ENOMEM; @@ -488,7 +488,7 @@ static int cyttsp4_si_get_ddata(struct cyttsp4 *cd) si->si_ofs.ddata_size = si->si_ofs.mdata_ofs - si->si_ofs.ddata_ofs; p = krealloc(si->si_ptrs.ddata, si->si_ofs.ddata_size, GFP_KERNEL); - if (p == NULL) { + if (!p) { dev_err(cd->dev, "%s: fail alloc ddata memory\n", __func__); return -ENOMEM; } @@ -515,7 +515,7 @@ static int cyttsp4_si_get_mdata(struct cyttsp4 *cd) si->si_ofs.mdata_size = si->si_ofs.map_sz - si->si_ofs.mdata_ofs; p = krealloc(si->si_ptrs.mdata, si->si_ofs.mdata_size, GFP_KERNEL); - if (p == NULL) { + if (!p) { dev_err(cd->dev, "%s: fail alloc mdata memory\n", __func__); return -ENOMEM; } @@ -548,16 +548,16 @@ static int cyttsp4_si_get_btn_data(struct cyttsp4 *cd) p = krealloc(si->btn, si->si_ofs.btn_keys_size, GFP_KERNEL|__GFP_ZERO); - if (p == NULL) { + if (!p) { dev_err(cd->dev, "%s: %s\n", __func__, "fail alloc btn_keys memory"); return -ENOMEM; } si->btn = p; - if (cd->cpdata->sett[CY_IC_GRPNUM_BTN_KEYS] == NULL) + if (!cd->cpdata->sett[CY_IC_GRPNUM_BTN_KEYS]) num_defined_keys = 0; - else if (cd->cpdata->sett[CY_IC_GRPNUM_BTN_KEYS]->data == NULL) + else if (!cd->cpdata->sett[CY_IC_GRPNUM_BTN_KEYS]->data) num_defined_keys = 0; else num_defined_keys = cd->cpdata->sett @@ -592,19 +592,19 @@ static int cyttsp4_si_get_op_data_ptrs(struct cyttsp4 *cd) void *p; p = krealloc(si->xy_mode, si->si_ofs.mode_size, GFP_KERNEL|__GFP_ZERO); - if (p == NULL) + if (!p) return -ENOMEM; si->xy_mode = p; p = krealloc(si->xy_data, si->si_ofs.data_size, GFP_KERNEL|__GFP_ZERO); - if (p == NULL) + if (!p) return -ENOMEM; si->xy_data = p; p = krealloc(si->btn_rec_data, si->si_ofs.btn_rec_size * si->si_ofs.num_btns, GFP_KERNEL|__GFP_ZERO); - if (p == NULL) + if (!p) return -ENOMEM; si->btn_rec_data = p; @@ -1977,7 +1977,7 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd) dev_vdbg(dev, "%s: Create the input device and register it\n", __func__); md->input = input_allocate_device(); - if (md->input == NULL) { + if (!md->input) { dev_err(dev, "%s: Error, failed to allocate input device\n", __func__); rc = -ENOSYS; -- 2.16.0