From patchwork Sat Jan 27 13:55:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10187473 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 0282A602C8 for ; Sat, 27 Jan 2018 13:56:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D959428C69 for ; Sat, 27 Jan 2018 13:56:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC3C328CD9; Sat, 27 Jan 2018 13:56:03 +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 72C7728C69 for ; Sat, 27 Jan 2018 13:56:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752358AbeA0N4C (ORCPT ); Sat, 27 Jan 2018 08:56:02 -0500 Received: from mout.web.de ([212.227.17.12]:61834 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752685AbeA0N4A (ORCPT ); Sat, 27 Jan 2018 08:56:00 -0500 Received: from [192.168.1.2] ([78.49.117.84]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Mhlmh-1eT9Hg0APT-00Mrlk; Sat, 27 Jan 2018 14:55:03 +0100 To: linux-input@vger.kernel.org, Arvind Yadav , Boris Brezillon , Dmitry Torokhov , Greg Kroah-Hartman , =?UTF-8?B?R8O8bnRlciBSw7Zjaw==?= , Jacek Anaszewski , Joseph Lo , Linus Walleij , Stephen Lu Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] Input: gpio_keys: Delete an error message for a failed memory allocation in two functions Message-ID: <6a34d439-6465-db9b-e8de-3f3b5b1ca257@users.sourceforge.net> Date: Sat, 27 Jan 2018 14:55:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:w0UoCY1lzCM+KT9lH6nadZmx0F2BUrDu+7sRIA85t27IrMKIhA3 BYZVy80Ij1f6h9QDoaF2yC8dpTJwnpMolRu9Kv3Bj5iXAOykafZ1DAR7lgK8DjUktBfBJJK eGZy2CNsunhrM44cd+pw3G/x7/erVvt3qClZbwdVcHQciOFqjXpOTNPokXWoQM1i10vAsWE Y9Avzs9iiv7Txg1s9GtAw== X-UI-Out-Filterresults: notjunk:1; V01:K0:vXBmZpbVDkM=:lJydkTmJJi4ZoOIgbIP5CU jewBlEDJEqX02O8UXwk8PFyq6GKBKFReATMPt08WIWv7bUpcbZi5yMM7LYQsFtFb8c9K+N7eA 33iRbCbyUU4+NbJDaCUJzP3GvjOIYAXBSctOYZxnM3s/VTttLvi8h9D5tkmzIRnGe2aqqJ7Q1 /F4Cd1ysjR2sWZZS0u8ZYvPURNzqoev49nlaUeEeS0ASyUDLuCy7dfz+3fiHyk+J38+f9KDPi D9+fykJSf2Q2QZ4rrMEJQiwJdcGWEVqSVeH4SBEqhAdgE7jeVqgvLUwZfmKxWYHoAlQAu2x35 u59E17ubjUQl2VQ/wiY4cx31zg4RsyFtbQs59ueM1LS/vkejBj3bQdGxHorCCeGLIPbQj5NTs Vv5nR8XuSHRoSS/yRPsPuE0vzOTcawjTJUjfyoKBYMs7woFrKs7AAC89uZX/F2nT8QC97pse3 vQhCLgp5gAv0dJpwtZUZM8t7wiD2yDdlKZwybE5YUc9tSbK/Rqa20qjP/5n2Fn7BUdPW0m58d uSuHPHBcFvl5L++qBDHdHWKZmMzgQuxcAWuQKYbPcKYLc3cpCTbs87iWAxPsuFfOIRJRfv/8G 72XkgSFmXGg/RCRJ6WDxYXdGEaByNWATqueRufnfvac7u2cIqcOKaJ7Kwo7bT2xQQpU/nzEjx 7mshCkBYeL/d4e9Dnkymepjj44YsfGv9GQMyvi/sor5Llanad4sfTHOT3kGqiCU/emYzlDRHN nHR4wqzrIVNB8Mnl7f/MtPz2uKmX8ZZpx4ROKese2/7dM8bwfFakQCZC0rSBQzDZIUG2iwtN3 9cPPRYhv+ULDltYwr/mG7U+hEvKjAOotwvDgStS3ArNEoKISg4= 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: Sat, 27 Jan 2018 14:42:19 +0100 Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/input/keyboard/gpio_keys.c | 4 +--- drivers/input/keyboard/gpio_keys_polled.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 87e613dc33b8..d12fccf923d2 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -757,10 +757,8 @@ static int gpio_keys_probe(struct platform_device *pdev) size = sizeof(struct gpio_keys_drvdata) + pdata->nbuttons * sizeof(struct gpio_button_data); ddata = devm_kzalloc(dev, size, GFP_KERNEL); - if (!ddata) { - dev_err(dev, "failed to allocate state\n"); + if (!ddata) return -ENOMEM; - } ddata->keymap = devm_kcalloc(dev, pdata->nbuttons, sizeof(ddata->keymap[0]), diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index edc7262103b9..c79b1a75d036 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c @@ -253,10 +253,8 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) size = sizeof(struct gpio_keys_polled_dev) + pdata->nbuttons * sizeof(struct gpio_keys_button_data); bdev = devm_kzalloc(dev, size, GFP_KERNEL); - if (!bdev) { - dev_err(dev, "no memory for private data\n"); + if (!bdev) return -ENOMEM; - } poll_dev = devm_input_allocate_polled_device(dev); if (!poll_dev) {