From patchwork Wed May 17 15:45:25 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: 9731509 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 C93AB60363 for ; Wed, 17 May 2017 15:45:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA67B28285 for ; Wed, 17 May 2017 15:45:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEB9028473; Wed, 17 May 2017 15:45:37 +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 2C9AD28285 for ; Wed, 17 May 2017 15:45:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751957AbdEQPpg (ORCPT ); Wed, 17 May 2017 11:45:36 -0400 Received: from mout.web.de ([212.227.15.14]:60064 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751300AbdEQPpf (ORCPT ); Wed, 17 May 2017 11:45:35 -0400 Received: from [192.168.1.3] ([78.48.117.83]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M7Kek-1dwvI042C6-00x0sb; Wed, 17 May 2017 17:45:27 +0200 Subject: [PATCH 1/2] spidev: Delete error messages for failed memory allocations in spidev_open() From: SF Markus Elfring To: linux-spi@vger.kernel.org, Mark Brown Cc: LKML , kernel-janitors@vger.kernel.org, Wolfram Sang References: Message-ID: <894ea82b-c53b-ccb3-63b2-4adabe518a6d@users.sourceforge.net> Date: Wed, 17 May 2017 17:45:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K0:nQZQd+ryoHFjU7p8sV5MwPhcG5WolNR+ccnFyDmf5GJk6dZ350K d36Qkw8VqkDAfGnHbWY1XvaCJ60h5DLUJb+SwbFTtUQtne/oad7h9pdyx9L6xz1g5LSgqxv ME8xohrx81ajz4OwvBcVjYC8edTfr3AnsqpONeKGi7XDJq2E/LFAYWtg4AutZzkpA3GQp+E WbcjTmCPME8m1U/Ra9Hsg== X-UI-Out-Filterresults: notjunk:1; V01:K0:hgVgbdpMlI8=:ofQewOVoN3MFKvYyhzaGRd Fq9tvs02PEFKld/AqUNJWetaJUILBI8JSF/LhLaUokaZbi6gJ+NYZ55YFEAJNILa1WkyOMN/W 31LDNtixc5VBtTpispGKc3Rz5MdN3y/7C40F70UN/Z4gYALI/24C9Ep33wh8qCcRkpxY8AqKq pCgKTvW9pv6pMo113bZQAIP6Xn4XIT+GXv3A7qBw2ij+a4CKr10qkOjeEi56glxPq4NPJjQin tcTLi5BCx53h9PSQVUaBL8qulujvDM857kX+62CNm0OQLvKv2W+gZxFwtqy3wbgZVJ+8fL4cj dKHVQtz2tmwEfwMtyOtcBaS51CTRNv7YnLtesdcxi0mJDFhB1ki7w5Fq5acB89hjb8p/WEbsy NwEC8zae+o+7a37Zc9+/RiXgY2pfQQl1TIe0VMpvad9Eevm7rvjOhqR8dC0iXFCt6TmwJfyQW k6JnskPRvR75UHzMGJmDG7nxwaq1icx7zZ8BVGZpTqkrsgPEDzTLXOjaL6leCobUD4MSe+qDz jjH9zsHukUSt9hTxV8cgEEDe+Oj9n0sscF3bJRM3lf4rzoAmdwqEH9SghZiISN9Nk1lx93bny agAu4UCiz6vLesjOc+Ecw3j7+T1mXP/muMRKdEJQeg6lEYd65hgB5YutsZr0Xo2GxpxyJP3R5 Z+Lba0zxfbhE/TOBSNm1P4E4Ab4Ty+dtwY7g3oNRMqFuq11Ugt9vFM06N7JAtmLN8BzS8wPJW XvgE1Q4Rlh6gi93inSKPPL3uLjlWjVw55neydsOxtlaL/WDI6Di/jWxhUJjj1mZQuzJH3EMqb TPYJJl5 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 17 May 2017 17:17:49 +0200 Omit two extra messages for memory allocation failures in this function. This issue was detected by using the Coccinelle software. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring --- drivers/spi/spidev.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 9a2a79a871ba..e6dc37fbea4e 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -603,7 +603,6 @@ static int spidev_open(struct inode *inode, struct file *filp) if (!spidev->tx_buffer) { spidev->tx_buffer = kmalloc(bufsiz, GFP_KERNEL); if (!spidev->tx_buffer) { - dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); status = -ENOMEM; goto err_find_dev; } @@ -612,7 +611,6 @@ static int spidev_open(struct inode *inode, struct file *filp) if (!spidev->rx_buffer) { spidev->rx_buffer = kmalloc(bufsiz, GFP_KERNEL); if (!spidev->rx_buffer) { - dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); status = -ENOMEM; goto err_alloc_rx_buf; }