From patchwork Fri Aug 25 20:23:56 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: 9922749 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 12CAB602BD for ; Fri, 25 Aug 2017 20:25:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0547F28531 for ; Fri, 25 Aug 2017 20:25:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDB0628537; Fri, 25 Aug 2017 20:25:05 +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 6548928531 for ; Fri, 25 Aug 2017 20:25:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756004AbdHYUYJ (ORCPT ); Fri, 25 Aug 2017 16:24:09 -0400 Received: from mout.web.de ([212.227.15.3]:51655 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754617AbdHYUYH (ORCPT ); Fri, 25 Aug 2017 16:24:07 -0400 Received: from [192.168.1.2] ([78.48.209.8]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MIkOm-1dnY4D450K-002IXK; Fri, 25 Aug 2017 22:23:58 +0200 Subject: [PATCH 1/3] SCSI-sg: Delete an error message for a failed memory allocation in sg_alloc() From: SF Markus Elfring To: linux-scsi@vger.kernel.org, Doug Gilbert , "James E. J. Bottomley" , "Martin K. Petersen" Cc: LKML , kernel-janitors@vger.kernel.org References: <0fffccee-7cc1-1321-2c6b-00ac06b304b8@users.sourceforge.net> Message-ID: Date: Fri, 25 Aug 2017 22:23:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <0fffccee-7cc1-1321-2c6b-00ac06b304b8@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:pJF6qndgIlzV1e2b+c0hCLuAbwucbBhtGwUbY03TvrS0U5EcbHJ 2j8leE4+irOKJuwXLgJ24uY4Z8gH1AB8GZhnLu2wwwyxfDaQti1McJuNtWyBTVF5dQFiQzz tzehIoq5x81iBUwGtkcuqyURIVxU+/cTVNp7yKI1LPhKz8+vIL6mzss4DgIGP5xPWV26yYm peSfEUd6aAjz8FySjYHog== X-UI-Out-Filterresults: notjunk:1; V01:K0:OkK7uOkmz54=:n2SUpaNqk0NUVrHOowZdTX /++CmaP/1RE56Riu1O5xcTBId7myoFssNLv/4U+mBajKC2joNTlqH3ehv49HT/YD9HllCUDso 5crBJENLKm3pA16Pvc/Wh2A9P0y7l65sh8+zfFhsyRj3aw52MfdAUFiuYyBHlawZ49VacTdtG Qwm6aEjQfEhNMZ5DLtfpiO342IPCIrA9dlPfQWzKKtsJDsrQA3/+66rBXMwmXzO8oR8PcxZId JEtFoHf1SkoSF4xMq9gqQhKCcTvghotkAulvVGgIU4OURmPz9HM3OglnzTKqVbp+yBVjKbhTC KefBLKERsFSZKVDCfhsOjfEzttfEXl4bz2yMsVhdCQwE5bdSoLBYNWfZYrdZXE7YKck1RhcSA HCQTQidYIXTD4j43GbrDaezaBc05XHxdPptgCkRmYgTHCtl68NMhgts6XuvHc0foh92ioVxu3 T+aqLkZ50jDtcl5miarqW6j3l4xK87rN4CzWDW8LNA3e6xQqjyY631vRPYnvPfs0ZJIMuwHWl OGB/ayrMjbAGqeWHl4AEwHg+kab6yHXIg7bRDPmOnmfLjC3VdJwjQwxSL1QkXsDvvoiXK7atG JbYnvdT7iI5Y5WCX8qhO+GxuvX9u83y+YCzEqFPzHYKDCIu6o7r2tjjVb0cTy2MK3FNNcheGp 1Hx5OdyExTnZqZfeFdnkEpgUOOzbM4gUsw7nlz+jQFqUQItZNjQWSV8nlOioRQqJeTI0/o6CT xJzjVntBHcsOmxE/D0/JbZwMO1Y5YDZBxh4+EbNz3dN8smInmQphp9zRkX/VmIl6MDTHV799k Y88rLCE0550UwJH8R9FfGybMnQnH3wJ6yr8BSGcZri5tUmSrAA= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 25 Aug 2017 21:48:11 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/scsi/sg.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index d7ff71e0c85c..8ca10a2fc1a0 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1404,11 +1404,8 @@ sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) u32 k; sdp = kzalloc(sizeof(Sg_device), GFP_KERNEL); - if (!sdp) { - sdev_printk(KERN_WARNING, scsidp, "%s: kmalloc Sg_device " - "failure\n", __func__); + if (!sdp) return ERR_PTR(-ENOMEM); - } idr_preload(GFP_KERNEL); write_lock_irqsave(&sg_index_lock, iflags);