From patchwork Mon May 29 07:35:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 100131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1339761vqr; Mon, 29 May 2023 00:41:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6yjqxEXj6FwuoIB+wVVMAZDGK0ExCaJ0szg+bzEC0pVqOazr57FF29zf1g4ean3/+aPZ5x X-Received: by 2002:a05:6a00:24c1:b0:638:edbc:74ca with SMTP id d1-20020a056a0024c100b00638edbc74camr14417675pfv.0.1685346071311; Mon, 29 May 2023 00:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685346071; cv=none; d=google.com; s=arc-20160816; b=SgWQc1bRxn8D8dPwMcO1lGYbb8/N3wadcTgfc5efPy8HwWdblHUx2qTE8Mgk7fTlA1 ZE8wCpV+3O6119iVveXiXC2WYA1U+onx9rWXFdgvQg8aQRd90X+X2/T33a6e0huMhtqM euENTMjPXtQwYWR2U4+/fyqUgfNxk2BCdLJZDXcJJrVPvJ5oj5tjBRhDVoIF2Kp5xzfP FM3zhNiDe8fo8tLnC+GaX0dfeD9Y7Q/To96LsPE38yIVI2DOCB1uBMXG0hi0DF8HgqIV zHrRZfxya8eAVdUXTd9RomsuLMmRMceP0p1qq18/cuAkZnOefdqB8bY7zY4IpA/tthhX ldJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2bdE5rxx0WNW70pykzA3LEgDROeECRTKYNJpXeGJheA=; b=SbcEtZ6TPNo4L0krzwoGm2F8dsK+OfoB1NjpbPt8iKqqWDMqepN5gz249FimQq0+1j kxSC2pZIZPCxJESYJJzM6SofT2aS0YkKwGPU7fQR9eewpYWrvtfdvYjJunezN7IHRqz3 cfarE+gqF0mag6hTS4sg/8VMrb3qJVUmfaAaC6rl3k9p6D0jNUFWI9cCaOtMzV5xyiPK woWzWnITTwqtAl/GBkO5JHNKdUipGFpovfSnysFOCflQJ2UwVsnN8T6dG/v2JKxn5dxq c8TfXfMok6d5J5sf71M2tI/oSLl+woYXrZHnX1+ANI/aAWa2KpZo6Xj5VJq+cBF3WKvg 3h0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="Cd9iq3K/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w28-20020aa79a1c000000b0064e250e1e64si9427706pfj.172.2023.05.29.00.40.57; Mon, 29 May 2023 00:41:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="Cd9iq3K/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229610AbjE2HfX (ORCPT + 99 others); Mon, 29 May 2023 03:35:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjE2HfV (ORCPT ); Mon, 29 May 2023 03:35:21 -0400 Received: from smtp.smtpout.orange.fr (smtp-28.smtpout.orange.fr [80.12.242.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D1D4A7 for ; Mon, 29 May 2023 00:35:20 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 3XPKqHvCt7PLm3XPKqcUIc; Mon, 29 May 2023 09:35:13 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1685345713; bh=2bdE5rxx0WNW70pykzA3LEgDROeECRTKYNJpXeGJheA=; h=From:To:Cc:Subject:Date; b=Cd9iq3K/CU8lcBda2pvGwM8YS8As0QUQU9FdZ5ldnukC40VE3f0SzxYU5LOuKwGvx hVP5ReGttXo7LC71uSjjMO38DQ6S8N0zcoirt+/GPGacR2L55UAJYZGnuk5GeS3h77 Z7avrHlEZM8W2qmTeHLY3QqK7p+3atNl1ixZyxJsbUzLDjs2qysoL+ORkAXyeRAwkb +GIMo6vGGsKR/MzzlL7LPO2nj+nN7g5+5Mlm9sVNXKmnbS2lFZ97+nreUdSlPno89j sCp40vhU8/yCOin6MujsXWCujiGjP5o70epm/YUmfQI0sPSr6yr/CCFKpD0LR7g95Q PRifGMxA9exbg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 29 May 2023 09:35:13 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: "Michael S. Tsirkin" , Jason Wang , Paolo Bonzini , Stefan Hajnoczi , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , virtualization@lists.linux-foundation.org, linux-scsi@vger.kernel.org Subject: [PATCH] scsi: virtio_scsi: Remove a useless function call Date: Mon, 29 May 2023 09:35:08 +0200 Message-Id: <08740635cdb0f8293e57c557b22e048daae50961.1685345683.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767213442096517867?= X-GMAIL-MSGID: =?utf-8?q?1767213442096517867?= 'inq_result' is known to be NULL. There is no point calling kfree(). Signed-off-by: Christophe JAILLET Reviewed-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi Acked-by: Michael S. Tsirkin --- drivers/scsi/virtio_scsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 58498da9869a..bd5633667d01 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -338,10 +338,8 @@ static int virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi) int result, inquiry_len, inq_result_len = 256; char *inq_result = kmalloc(inq_result_len, GFP_KERNEL); - if (!inq_result) { - kfree(inq_result); + if (!inq_result) return -ENOMEM; - } shost_for_each_device(sdev, shost) { inquiry_len = sdev->inquiry_len ? sdev->inquiry_len : 36;