From patchwork Mon Apr 24 20:17:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9697141 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 8A23D601E9 for ; Mon, 24 Apr 2017 20:18:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8094A28066 for ; Mon, 24 Apr 2017 20:18:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7503A28419; Mon, 24 Apr 2017 20:18: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 F35AA28066 for ; Mon, 24 Apr 2017 20:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S977561AbdDXUSJ (ORCPT ); Mon, 24 Apr 2017 16:18:09 -0400 Received: from mout.web.de ([212.227.17.11]:57636 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S977540AbdDXUSI (ORCPT ); Mon, 24 Apr 2017 16:18:08 -0400 Received: from [192.168.1.2] ([77.181.233.174]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Lk8t4-1cQvqI1tyk-00c9pd; Mon, 24 Apr 2017 22:17:56 +0200 Subject: [PATCH 2/7] HID: sensor-hub: Delete error messages for failed memory allocations 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, Wolfram Sang References: <2d526d72-a740-367b-04a9-ed698435f8ed@users.sourceforge.net> Message-ID: <7f9e0982-90b9-0e74-4732-7e3153813b2b@users.sourceforge.net> Date: Mon, 24 Apr 2017 22:17:54 +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:bcHo24dysotEtHRtqp83YNqF7kk6gmGDX82EbZOqlMksxSEHfV3 M6kuLB7ZSqdvMG12UuO6+wjeF7z60vAfORBOL5hPS0Y+OsFMQV6On+DTC6wRMSQe32Y2dRP tvnkO9Dt9Um1vf4vZVpW3eRlrqp8wwiay+4o6rXnLW7aSgxwyQ/ZJo4HHFX/Q3YU7A5uLAp 9ZnEdz2g99G3TrwS3WobA== X-UI-Out-Filterresults: notjunk:1; V01:K0:DORNrthEVt0=:7taaKGLkG2qIj6mwihIK93 /tW2Ve85KFMODoUp0FktnkWJgUwfuNf3yoO8+Im8qIYQBdj03HdnENWeDKSPFpEGA8TS8NNIP gaiN5JorFREtrHbfEEL+/Ym4c9DUEi+rKoLOMk9nyWlbCxjFsEl4V99piBcmuj1rThwo9BmKd ik5BLb96tJeBa+HqV9fp37OQdscLM8ECeTu97Banj6rNKwDRU2M68r9BPgKbVzed9h34C06of UeXd2v0unZZYrTm8fhU23KLQ+doYVdpiPTRcu8DXYtiODsPGLTdMGEUuzLvTHiZz22zq+q/FR IYh2FRF8Xlr81bZORx1HZX5KZpwSrkiKuDe86Esg8aeiiIl4pMx2sNqZeqeYklNLI8WVOcWfe PKHJhu+fjh6MbMUivJoWz13RDaHxjjw74Ez0nidA/1aZbYNdNNuF/ka/MRjHUd2Ze+72wLfYF Y8TtgE5Pem5j6VbZnnSDzwcIxlMZlXxo8FPmkeppfNH+OHMNPqMcty58zC0yXNtMPUTLNC68F f2SFtJwenGfgCu6erBDsrsaEBSs9jABM1m3QnaeoygamcUv6/MdhiSslcAFMiR/oF5L1tNCTs kP0d4/5NsDQV5UJtCgn0Yo/4sP386M7yO/OxyLdCyH/gnjlHWktcD/LFAkyct30jewf6kDzfG A7LaVpVBF4lmeVXc4Kw3JsjXXUfmlklKh81N8OOl79VT4F1eP6c51qBVeFQ3CBgjjTTKvrXoy jr5apJ7tVqpXy013ehU4TbFEP6W+SRuf2dFc5oCHuI3qUplCN8f8XdmPyLBffnBe4+HSCPQ+O M0lU9Ps 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 19:45:25 +0200 The script "checkpatch.pl" pointed information out like the following. WARNING: Possible unnecessary 'out of memory' message Thus remove such statements here. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring --- drivers/hid/hid-sensor-hub.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 349494fc8def..feb4bb8ee3ec 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -640,10 +640,8 @@ static int sensor_hub_probe(struct hid_device *hdev, struct hid_sensor_hub_device *collection_hsdev = NULL; sd = devm_kzalloc(&hdev->dev, sizeof(*sd), GFP_KERNEL); - if (!sd) { - hid_err(hdev, "cannot allocate Sensor data\n"); + if (!sd) return -ENOMEM; - } hid_set_drvdata(hdev, sd); sd->quirks = id->driver_data; @@ -678,7 +676,6 @@ static int sensor_hub_probe(struct hid_device *hdev, sizeof(*sd->hid_sensor_hub_client_devs), GFP_KERNEL); if (sd->hid_sensor_hub_client_devs == NULL) { - hid_err(hdev, "Failed to allocate memory for mfd cells\n"); ret = -ENOMEM; goto err_stop_hw; } @@ -692,7 +689,6 @@ static int sensor_hub_probe(struct hid_device *hdev, hsdev = devm_kzalloc(&hdev->dev, sizeof(*hsdev), GFP_KERNEL); if (!hsdev) { - hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); ret = -ENOMEM; goto err_stop_hw; }