From patchwork Mon Apr 24 20:18:57 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: 9697143 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 010A2601E9 for ; Mon, 24 Apr 2017 20:19:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAC7D28066 for ; Mon, 24 Apr 2017 20:19:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF4F12841C; Mon, 24 Apr 2017 20:19:13 +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 7E45928066 for ; Mon, 24 Apr 2017 20:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1174293AbdDXUTL (ORCPT ); Mon, 24 Apr 2017 16:19:11 -0400 Received: from mout.web.de ([212.227.17.11]:61117 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1174252AbdDXUTK (ORCPT ); Mon, 24 Apr 2017 16:19:10 -0400 Received: from [192.168.1.2] ([77.181.233.174]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MMmx9-1cukEG1w9H-008WXT; Mon, 24 Apr 2017 22:18:59 +0200 Subject: [PATCH 3/7] HID: sensor-hub: Adjust two checks for null pointers in sensor_hub_probe() From: SF Markus Elfring To: linux-iio@vger.kernel.org, linux-input@vger.kernel.org, Benjamin Tissoires , =?UTF-8?Q?Bruno_Pr=c3=a9mont?= , Henrik Rydberg , Jiri Kosina , Jonathan Cameron , Srinivas Pandruvada Cc: LKML , kernel-janitors@vger.kernel.org References: <2d526d72-a740-367b-04a9-ed698435f8ed@users.sourceforge.net> Message-ID: <89ec267f-cae0-66b2-bcd7-27d786af3a5f@users.sourceforge.net> Date: Mon, 24 Apr 2017 22:18:57 +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: <2d526d72-a740-367b-04a9-ed698435f8ed@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:1MiqmfJKV9oWLc2bLfMcMsoyEv6b/lqRzo/Xv0ijw6P0odJ/LjV P8fyDeSj1N5eHtsdSDaIOtO1DvuAM+CrchP3pM5jC2okEpk6lM/xvZlKkB0kSi70VrTrPd0 ZRXIGuLnSwEVsRVPH9+1BR3bnM15sWUyyqcV3tSy6yYDS05vKLvCxJcAQTUspUVMigOpEvO pEOEk9aMgm1I39xY5UKoA== X-UI-Out-Filterresults: notjunk:1; V01:K0:JmtugjexvxU=:Q4OSqk/ZSn8FrdoXd0J6T2 N9MOpTFGPGF+MuoYMNV8tyMzXmOCEkD7rHkngwGUNKh/3vdRKx22TTa/7tkuZzBb2LLMGuDwa 6g8+PM6bqzw9dSi6cEUT5lgu/k3HDyHEG6envYVnLasPJbN/e5sBpr1AxN9hKmU6oaKGryHFQ dT6Heos6T6KLPAzM/vaBiUyvV8fzU9CMzeLv5Mu3mjqTW1bgyM0X7Z4PQBI0ubl4z9mAsgf3Q Xa9Uv9yukQcbLHxLgY9AvZvv0hhOzosz3Rv733t5n2AtrBOfUsOyvY/5vujSukJgEJH291R88 B3u241EAdPZWYyP4ouhIQGLnnUfLN+0LuDTjEA+xULmwwgt2Ic2POmJSDlmcCGnYtb7yLBM2m qDqA4km4BiAOse9l0VYrdF2U5gEpAuDob1+XgJxYMtjHyj5e41bWeA1AbHx8R8K6lV3pcI9cp 08KuKPdTTmkTAL5bC/vKZy/ERClxHAamXm/IzgtY818GtkT+ww+HzsspJSMEL5X9y3so/wVSD GMWZ98+e67nLRLz9xItVxiU/6NPT9V0wkTDeGA3CISD0U1dRZ5ZJSWFmEivdeSUlSAelEVgMV LTiF4DZxHcj6Bb+ZxPcsmrxIr0K5AclNQK1P7yev17ob+DVP4Zr4UpcseXl/W1Er1dI7o5Kwl DuIRR/sU0PSJ+lAoC9fSNKuUhOAIlrEFqyrOdIHXpFbLb0k4IaqRLj6PFcBUDmx4DsxENO2o/ 4EuVaS3AED1rvA+OU+Ee4wt8/s8ycR2wCTxrFbhOX5dt42C4/A6ZXYeZM3im+M6sNNklModsl x0iWPPz Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 24 Apr 2017 20:00:06 +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/hid/hid-sensor-hub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index feb4bb8ee3ec..4eadaef19e6a 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -675,7 +675,7 @@ static int sensor_hub_probe(struct hid_device *hdev, dev_cnt, sizeof(*sd->hid_sensor_hub_client_devs), GFP_KERNEL); - if (sd->hid_sensor_hub_client_devs == NULL) { + if (!sd->hid_sensor_hub_client_devs) { ret = -ENOMEM; goto err_stop_hw; } @@ -711,7 +711,7 @@ static int sensor_hub_probe(struct hid_device *hdev, name = devm_kasprintf(&hdev->dev, GFP_KERNEL, "HID-SENSOR-%x", collection->usage); - if (name == NULL) { + if (!name) { hid_err(hdev, "Failed MFD device name\n"); ret = -ENOMEM; goto err_stop_hw;