linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: virtio_scsi: Remove a useless function call
@ 2023-05-29  7:35 Christophe JAILLET
  2023-05-29 14:02 ` Paolo Bonzini
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Christophe JAILLET @ 2023-05-29  7:35 UTC (permalink / raw)
  To: Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, virtualization,
	linux-scsi

'inq_result' is known to be NULL. There is no point calling kfree().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-08  1:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-29  7:35 [PATCH] scsi: virtio_scsi: Remove a useless function call Christophe JAILLET
2023-05-29 14:02 ` Paolo Bonzini
2023-05-29 15:25 ` Stefan Hajnoczi
2023-05-31 15:37 ` Martin K. Petersen
2023-06-02 12:06 ` Michael S. Tsirkin
2023-06-08  1:42 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).