From patchwork Fri Aug 25 19:21:08 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: 9922727 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 A015A60349 for ; Fri, 25 Aug 2017 19:21:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9340822A68 for ; Fri, 25 Aug 2017 19:21:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 881B9284BD; Fri, 25 Aug 2017 19:21:33 +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=unavailable 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 4454322A68 for ; Fri, 25 Aug 2017 19:21:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758206AbdHYTVT (ORCPT ); Fri, 25 Aug 2017 15:21:19 -0400 Received: from mout.web.de ([212.227.15.4]:58081 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755611AbdHYTVS (ORCPT ); Fri, 25 Aug 2017 15:21:18 -0400 Received: from [192.168.1.2] ([78.48.209.8]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MWRkA-1e199q48hG-00XYsR; Fri, 25 Aug 2017 21:21:09 +0200 To: linux-scsi@vger.kernel.org, "James E. J. Bottomley" , "Martin K. Petersen" Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] SCSI-scan: Delete an error message for a failed memory allocation in two functions Message-ID: Date: Fri, 25 Aug 2017 21:21:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:iK0XUtIvLhFAcBnv9Bd2ao7s+s/LK37A10Ul9Go6aHjK8pYd+9Q HGHYgSjEwYsUCQKGjgAnHaRzdo7KV8M8BdqQSC6QHzmUpMAuynUSaCg+NsYXV2ckpkh+uIs fRNlmbH1Yjur9bTaLONlrz6g+GzctYdHUFsGCmJeELmUT212v9syDo4yZPqpJ/ma85xwbGf YBs1fSs8+XWdz/JTeWoSQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:ITFcuyWxD6E=:lK8zvMKqmgEn+qhhdAAT4t Lt+jh8soUBsJARTX/jPxqyD2YdANXBLVluEYLleQvY25I/TpepH3R/Yp3LSjLzjfPLjsSG8Yi OZIWm5k0igf69FIfBuxcEKV30Tjcz6DWOFAbskTk20GqQHOMopatQK0oSlmLQoueQfhPBFsDO alqv22MExG5qUi5EGNlIsmq4tGpMhz+o+pK7lqDjUwDjD0gYPnE2HSitfbeL1IPUPd3b+/lNS PbZMzDKI5VuX7bYkqFWM40Mie5dji93AhmFpydJ+w9c8uxNkLKyx0ljhQtMBoClwyvNTjSIPQ Zn/X02ao3Kejn25FttDwWcM8EEFpn7DIuYK8aj/0+9o3lCwl56AC776oHvHz4869U7qAwy6SZ sGRn1JOAYffc6Q7VXdJaJ6kmnYG9G/7TFBOmJ3YsqVly0Jx45aUOzW5V99MwTTBG88YshAfe4 sm0zOOypEkIRUZ1MH/v90hBzrD5oQaX7b9DgrlOJoxg4JkXPExrlJqcqD+jj+mGXsLR6sNNld b2C6G1ByTp1Ius8BgPjHkJRpnoHK7ZyyvceWT+++BIJHJY9kvIe3fGUDHawzjWyhdIcLAWEmo Fjhp0OSvoKyc81HRkiQFqogseylinjSAVjiSk3QqddJ1Q9FSJ8kFETohOVOcHS95J74q5DpcD zuMpnTnjqhSg3T+7JnOvtFSLz2zrZ33I52Xb28KdRamYQhJLIQfdVwXEB1jxxHq5RWm9yny0R 4Zlqp33520BvRSWjGCf/6ZhfiGEfdIwmtYP+osq+PmoRXCM14Y3WTE5KX5PTIwAzy43uw9IwA 8fVnwQ0OHVAe2JaAovWgB/XulFHEcr12ujK4iUtRbud+Z98r8A= 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:17:02 +0200 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/scsi/scsi_scan.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index fd88dabd599d..280ac20a644b 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -427,10 +427,9 @@ static struct scsi_target *scsi_alloc_target(struct device *parent, int error, ref_got; starget = kzalloc(size, GFP_KERNEL); - if (!starget) { - printk(KERN_ERR "%s: allocation failure\n", __func__); + if (!starget) return NULL; - } + dev = &starget->dev; device_initialize(dev); kref_init(&starget->reap_ref); @@ -1340,10 +1339,8 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, retry: lun_data = kmalloc(length, GFP_KERNEL | (sdev->host->unchecked_isa_dma ? __GFP_DMA : 0)); - if (!lun_data) { - printk(ALLOC_FAILURE_MSG, __func__); + if (!lun_data) goto out; - } scsi_cmd[0] = REPORT_LUNS;