From patchwork Thu Apr 27 09:29:49 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: 9702631 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 0CA3A602CC for ; Thu, 27 Apr 2017 09:30:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03F99268AE for ; Thu, 27 Apr 2017 09:30:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECB6828630; Thu, 27 Apr 2017 09:30:42 +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=ham 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 7CD16268AE for ; Thu, 27 Apr 2017 09:30:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754726AbdD0Jam (ORCPT ); Thu, 27 Apr 2017 05:30:42 -0400 Received: from mout.web.de ([212.227.15.3]:64697 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752935AbdD0Jal (ORCPT ); Thu, 27 Apr 2017 05:30:41 -0400 Received: from [192.168.1.2] ([77.182.201.44]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LnS3i-1dkxW444qM-00hfUR; Thu, 27 Apr 2017 11:29:51 +0200 Subject: [PATCH 2/4] hwmon-nct6683: Adjust five checks for null pointers From: SF Markus Elfring To: linux-hwmon@vger.kernel.org, =?UTF-8?B?R8O8bnRlciBSw7Zjaw==?= , Jean Delvare Cc: LKML , kernel-janitors@vger.kernel.org References: <2f58a509-4aba-5c44-bc79-568b260ab692@users.sourceforge.net> Message-ID: <339214ae-9c04-9e8c-e97e-368aa83a17b5@users.sourceforge.net> Date: Thu, 27 Apr 2017 11:29:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <2f58a509-4aba-5c44-bc79-568b260ab692@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:RmjBQQdoAm8LRxfpPHSIUeYj6KjRV06B46vyUOAL7gJ1AL0qyr5 SjjzCSY7ukiio4zouTBDfKTNvTIvQ+n1NpDrly4ZCR1jNJLRgXqTR+czsevahObw9sO+Rsm NbfX+a0n8TZMxpTZpov99rWWXBrLUqlTLdvXeUW3s421C5QNctp6yTIitAslF7CIDrMjMJq ofJ1aKooHNyoK7HO/Ol/A== X-UI-Out-Filterresults: notjunk:1; V01:K0:Yzrg4fuAr9A=:3+rv7z+g/cJmfh7phnuGkS VbNprnlrTIELywHCtYOhnfGa5cPRrwSywheV+XlkdoauwDog7WUBiTMf8lxVD6y/sT0j3pgAV NhWsTJqYN6jlwNKQmnHDNWoxHxqDe9Cqv4cZtNFRLjAjjIJN4GeJ0oqjjh1c+H85iMxzPFAH5 kbqJKa+qYHzIDrHbQtXH6LJhevbZ+Lol/bH8uSpWVRw4T9edJUaR/L2lOi5M6ly0jTaaOUYDT trxkbP4cPcfFTl39+Md7Qhea0bU1bDlOlN8c2HXQBA/lXZ5B4TpcZpRBHllnwHmhj6YsfNovK fB8jgikVzXL1Cg7OonS9aCriUfJ9czmuxJGKmUHQA+8MokU6IwW9iMTkYkqyKHglzazOlflEJ lCqcQU+vMHhKHqSYU+X+XQvP1toxPswJVyx766x1KxAtSHe+IXDofeCyD8RYGaJUOMgUToUMs SOPCicA8aeYjgiQiJGRK6mkNDjJU55xZlhzug0WbW6habNNoqI2hTtu6XC258/E47SSI6DZJY F2Bhw6KyHh6EHvHnRNKlf5e5Fu27iDVfMs9bX/4ybiNbvFwyFdPAMk/K5mf1Kd/X0ccQwz6jM TGjZ1n9wfWy30QYfLL91YecNeIpDd/J8fwmb8hcr5+3FI8C8s0qMjjI6Z1keUoEq3VaMlpnBd E92qlg0ZWmEvjigCNIYnMYZyoN3sn334OflnVcvjt8Cw/aFYJUgaka4fm4jjq7TsI1qk8HxBc VqGhGZ3a6ONLiCVmFNkuR6Mkl9ATsV6Goi3A9NfTfQxGrRps96S+A7a7VmrQPk327ta2wKnoN XpvHd4l Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Thu, 27 Apr 2017 10:22:39 +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/hwmon/nct6683.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c index dd14a98cc6dd..4deb46ce8834 100644 --- a/drivers/hwmon/nct6683.c +++ b/drivers/hwmon/nct6683.c @@ -423,16 +423,16 @@ nct6683_create_attr_group(struct device *dev, return ERR_PTR(-EINVAL); group = devm_kzalloc(dev, sizeof(*group), GFP_KERNEL); - if (group == NULL) + if (!group) return ERR_PTR(-ENOMEM); attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs), GFP_KERNEL); - if (attrs == NULL) + if (!attrs) return ERR_PTR(-ENOMEM); su = devm_kcalloc(dev, repeat * count, sizeof(*su), GFP_KERNEL); - if (su == NULL) + if (!su) return ERR_PTR(-ENOMEM); group->attrs = attrs; @@ -440,7 +440,7 @@ nct6683_create_attr_group(struct device *dev, for (i = 0; i < repeat; i++) { t = tg->templates; - for (j = 0; *t != NULL; j++) { + for (j = 0; *t; j++) { snprintf(su->name, sizeof(su->name), (*t)->dev_attr.attr.name, tg->base + i); if ((*t)->s2) { @@ -1179,7 +1179,7 @@ static void nct6683_setup_sensors(struct nct6683_data *data) if (reg >= NUM_MON_LABELS) continue; /* Skip if disabled or reserved */ - if (nct6683_mon_label[reg] == NULL) + if (!nct6683_mon_label[reg]) continue; if (reg < MON_VOLTAGE_START) { data->temp_index[data->temp_num] = i;