From patchwork Sat Jan 27 12:53:20 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: 10187453 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 656F360383 for ; Sat, 27 Jan 2018 12:53:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 578AE28C78 for ; Sat, 27 Jan 2018 12:53:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C5A028C7B; Sat, 27 Jan 2018 12:53:43 +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 EC22C28C7A for ; Sat, 27 Jan 2018 12:53:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752776AbeA0Mx3 (ORCPT ); Sat, 27 Jan 2018 07:53:29 -0500 Received: from mout.web.de ([217.72.192.78]:61002 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752358AbeA0Mx2 (ORCPT ); Sat, 27 Jan 2018 07:53:28 -0500 Received: from [192.168.1.2] ([78.49.117.84]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Lc8c5-1f55lc3wv7-00jami; Sat, 27 Jan 2018 13:53:22 +0100 Subject: [PATCH 1/2] Input: matrix_keypad: Delete two error messages for a failed memory allocation in matrix_keypad_parse_dt() From: SF Markus Elfring To: linux-input@vger.kernel.org, David Rivshin , Dmitry Torokhov , Rob Herring Cc: LKML , kernel-janitors@vger.kernel.org References: <106bffd0-28ed-7c33-1f32-ae84b40f52c7@users.sourceforge.net> Message-ID: Date: Sat, 27 Jan 2018 13:53:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <106bffd0-28ed-7c33-1f32-ae84b40f52c7@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:/KIE/zTGzqLcscKl2rk9qi586WjTJzZnDd1bCjNsSBYSG31h+8K W8f2+XNLiTfTztIP0X9V2kVmzBVv/qyNSOvyJMnxKU9aWb0PAOTn1xa8qyVQVn70MV4IDI/ HxCTXuUWkzo/Up+KDkv/55N6s257OW6S3Y3qavifkUS2wurt81I82wMVr+Mw6tyo7iBbBIF kz0MZefrfELr7rJzC+MNA== X-UI-Out-Filterresults: notjunk:1; V01:K0:ucYXdw3UwB4=:8vOzHG7kI/jkAIG05dKHP0 Ti3D6MABGo/EMheiAAvSuZ8lVXBUj4gYhGHSGfOdzpNMSVTDWmcSi77WcXxQNOwPtnJi250MV SGp9f8Z1wb2LEtTK6mu390LjuC4FPioU2i5zq7AWntLulEhjqSzmoPbgK49gHAcDDDOq/rSId EecoxGh0NoVJeeLoTkE5bEn0KiB0RD+P3x/LXMh3nsIAJ38gjSgZSPL0YlGiDWPwjaEApxm8e +GNi36NOdIrF7fQujVFNOn6Xf2cwKN2hNgC6CSZyTNa3PzhMGDjTYr/w3Q8/1GS/cAFLM8R/T ts6IaZkiM3BwHe3EBRA5NZaVZVlXq+RRNetmaVue3bJZMJikhk1feGN2EVLeMmiLIGmz6wTpI cgnaNgSYaIpQ/Ij1Ke0pisFvXwx63IWWaS3T6vl1b/g32PI65aVqPzVuNs2sItizdgPjv+6KC oLA6DpjaRaC/lySTCcK8dWIhuQNjX+DBuNxYhoRP0KVWpTFPbmA4osy+izsUJUMWnsrqu0lz7 kze/zmTk4WzcogcS2xNvBEV6v5pfzTqkXSQ4lT441tlsBNGwWTy7PScJ+OnZSO1YN1h8Ov9ry a91aPJBeLDiODnovHCcM9E1zjlEd8Xks7llAGJRxY1WhHX+4mALOT9B8LptQlDPOnMLXzGQO9 kITcmsGoYvAR+QNZtErDbQjCPHhhdE58OO2Fwf9Ls6768HwMFfyhQ7U6v9PDygRFhDD8Tk6rn 8iQPAHAAaPxnpzHVwFvAI5G5cf8egCgaBHClsYGfTsEfmM7RfJmLe8Kg6O54M9fWU+9OfGuOu 0rwSiX4Dyn1iW/EunWZpmjwp5XLjTtLz8bM0QgGQuWM77hmM/8= 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 13:35:02 +0100 Omit extra messages for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/input/keyboard/matrix_keypad.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 1f316d66e6f7..90238201a9cc 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -413,10 +413,8 @@ matrix_keypad_parse_dt(struct device *dev) } pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - dev_err(dev, "could not allocate memory for platform data\n"); + if (!pdata) return ERR_PTR(-ENOMEM); - } pdata->num_row_gpios = nrow = of_gpio_named_count(np, "row-gpios"); pdata->num_col_gpios = ncol = of_gpio_named_count(np, "col-gpios"); @@ -445,10 +443,8 @@ matrix_keypad_parse_dt(struct device *dev) sizeof(unsigned int) * (pdata->num_row_gpios + pdata->num_col_gpios), GFP_KERNEL); - if (!gpios) { - dev_err(dev, "could not allocate memory for gpios\n"); + if (!gpios) return ERR_PTR(-ENOMEM); - } for (i = 0; i < pdata->num_row_gpios; i++) gpios[i] = of_get_named_gpio(np, "row-gpios", i);