From patchwork Thu Apr 27 09:31: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: 9702639 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 A4613602CC for ; Thu, 27 Apr 2017 09:32:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E810204C1 for ; Thu, 27 Apr 2017 09:32:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 917A0268AE; Thu, 27 Apr 2017 09:32:22 +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 B57AE1FF29 for ; Thu, 27 Apr 2017 09:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934542AbdD0JcU (ORCPT ); Thu, 27 Apr 2017 05:32:20 -0400 Received: from mout.web.de ([212.227.15.14]:62285 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754604AbdD0JcS (ORCPT ); Thu, 27 Apr 2017 05:32:18 -0400 Received: from [192.168.1.2] ([77.182.201.44]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MSWzU-1dVD203Q4S-00RbVq; Thu, 27 Apr 2017 11:31:24 +0200 Subject: [PATCH 4/4] hwmon-nct6775: Adjust seven 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: <7bf13cb6-55f3-c7d3-4b42-befb4a4e7d07@users.sourceforge.net> Date: Thu, 27 Apr 2017 11:31:21 +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:dO3mpr0b/Bb3q4zc2fZwdb6GEvhTLqel98JZw52+Kzlra6PyVzH dakC360lzhiY0tdBubdogQBu32m+djKCmFkHYyFsg/u8TwEoo13587GuSveWoxSN9HbBL3L rylfjA5yz8DPLHEK7teCrbCG4Uz9LKCSDh79UWTNtrlh0tZhF7XUSGFA08LOgfw8t50Dhxo WeLw+GZLgYfjQcINRBlWg== X-UI-Out-Filterresults: notjunk:1; V01:K0:GScJycrNwVQ=:/MwfV+XBbCAhQlxdj3rcVT Da74dumrcHrS/wk2KrnrnY7fajCAUEmQ4Y3N+TCv7CtZoGg6PH/qwN0XKY1yjEdAUFFEpi7J5 YVAbOW66VQdg2d/tp9aDk+ss9FNbx7b/gAsi2Y4DDkieyuh+bianUoOA0uTsPiwSr84+U2ITd XMqlXfiaOBlXYUs9leZoSb3YefFiX+oBP6nf7nRSKVQnmwFn2n2AHvWqKhworttu/WB2fO/To 42qna9yysvdzAGimcOvRo0UO0tIVS8CHWuJzzFK0ieE6lD/oSsMguCQQafogUjB3+VUIRhh1T /SZMYM04Us5Wx6KCQjk8k1Si+oXRWv+zkc50/Sh26nkWT5UoGD43+Lm3FUYJH06zLJLSFqUAw 7czx/tArphbhzl2lBaDd0jjjDzCz/CYcx5m9TaqHLPYCyBcNkmhUc0Xn6wIrKahhBRSpnokX6 eMVQgEcpBd9yawtFhLFB5yjCxhkbM/HXLTL4WeCtw3RCknt/v7QU71aL2VAF1WAfwp+uDWbuD n5jBBVJPgjrjXx3Dp6GPzq2rGoaHuWqftmBV4RJVdfwu3lGMwm7TW3/f39e8gvXB01mNtz7me Dkai1V53lOlT4HXZGuMA04obZdBME0j3RcI7RgN6rMO/pFfRgdZ2HQUzVCrCetAWAvMDdiBqy lo3u8e8z7sePQfJMUOTu5RKGtdcQl/3sCRFQpPLWIhsxor3NcFoljYUYRHe0gHxzxJj002bFx RQXJpTcoWHHW8R+5TJpwv4ptALQltELDPq0asaMXH/KlWCnjAkENXQVFVCE2cApa2wjKHej2p 4Blo9rM 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:55:24 +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/nct6775.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index d552ab7901a7..fe8713fb548c 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c @@ -1070,16 +1070,16 @@ nct6775_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; @@ -1087,7 +1087,7 @@ nct6775_create_attr_group(struct device *dev, for (i = 0; i < repeat; i++) { t = tg->templates; - while (*t != NULL) { + while (*t) { snprintf(su->name, sizeof(su->name), (*t)->dev_attr.attr.name, tg->base + i); if ((*t)->s2) { @@ -3000,11 +3000,11 @@ static umode_t nct6775_pwm_is_visible(struct kobject *kobj, if ((nr >= 14 && nr <= 18) || nr == 21) /* weight */ if (!data->REG_WEIGHT_TEMP_SEL[pwm]) return 0; - if (nr == 19 && data->REG_PWM[3] == NULL) /* pwm_max */ + if (nr == 19 && !data->REG_PWM[3]) /* pwm_max */ return 0; - if (nr == 20 && data->REG_PWM[4] == NULL) /* pwm_step */ + if (nr == 20 && !data->REG_PWM[4]) /* pwm_step */ return 0; - if (nr == 21 && data->REG_PWM[6] == NULL) /* weight_duty_base */ + if (nr == 21 && !data->REG_PWM[6]) /* weight_duty_base */ return 0; if (nr >= 22 && nr <= 35) { /* auto point */