From patchwork Wed Jan 18 17:46:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9524389 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 9F06B60113 for ; Wed, 18 Jan 2017 17:47:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 903B426E8A for ; Wed, 18 Jan 2017 17:47:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 850B92860D; Wed, 18 Jan 2017 17:47:42 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 3865226E8A for ; Wed, 18 Jan 2017 17:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753022AbdARRrk (ORCPT ); Wed, 18 Jan 2017 12:47:40 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:57273 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753017AbdARRrj (ORCPT ); Wed, 18 Jan 2017 12:47:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=References:In-Reply-To:Message-Id:Date:Subject: Cc:To:From; bh=298NA6Wg6K1wyH8ntxDdJzqTccPsqyGhQYwIM/7fIhc=; b=JaxI2HIujH5F56 Y+lUL6NJZTku752L/Hf9HDolcNMXlwWVXypGGWoXlCqCfYeg3tnLSxDNq6idZcu7UTE2dBLeLLKiD N4vOQ32xeoMeZRTZpT+2i1u8Z9dte12khq6ndwaAZPcMVG3puuQQnAvRtp3gkI76SKhoFxoG42xfi b3b6rmqZ0eMH3AkKzu3QEee4g585xYKhIt8GfgPSD68e/Zcp9HmR+r5CeRkavkcxB5IfnXM5BRhHg A13f591mgyBjL/48tUywqY/FqE8LxiiW0wsovmzr+/KHvG38rpu70DJu2C6bWGDMxd5W53RdeuZkR oJ+eLmD40Fg47PPnedZg==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:45158 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1cTuKb-001jBF-E3; Wed, 18 Jan 2017 17:47:33 +0000 From: Guenter Roeck To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH 06/33] Input: samsung-keypad - Drop unnecessary error messages and other changes Date: Wed, 18 Jan 2017 09:46:27 -0800 Message-Id: <1484761614-12225-7-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484761614-12225-1-git-send-email-linux@roeck-us.net> References: <1484761614-12225-1-git-send-email-linux@roeck-us.net> X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: 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 Error messages after memory allocation failures are unnecessary and can be dropped. This conversion was done automatically with coccinelle using the following semantic patches. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches - Drop unnecessary braces around conditional return statements - Drop error message after devm_kzalloc() failure Signed-off-by: Guenter Roeck --- drivers/input/keyboard/samsung-keypad.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 4e319eb9e19d..b6ea0cd3542b 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -258,10 +258,8 @@ samsung_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); - } of_property_read_u32(np, "samsung,keypad-num-rows", &num_rows); of_property_read_u32(np, "samsung,keypad-num-columns", &num_cols); @@ -273,19 +271,15 @@ samsung_keypad_parse_dt(struct device *dev) pdata->cols = num_cols; keymap_data = devm_kzalloc(dev, sizeof(*keymap_data), GFP_KERNEL); - if (!keymap_data) { - dev_err(dev, "could not allocate memory for keymap data\n"); + if (!keymap_data) return ERR_PTR(-ENOMEM); - } pdata->keymap_data = keymap_data; key_count = of_get_child_count(np); keymap_data->keymap_size = key_count; keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL); - if (!keymap) { - dev_err(dev, "could not allocate memory for keymap\n"); + if (!keymap) return ERR_PTR(-ENOMEM); - } keymap_data->keymap = keymap; for_each_child_of_node(np, key_np) {