netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] vhost-scsi: Fix typos and formatting in comments and logs
@ 2025-06-11 14:39 Alok Tiwari
  2025-06-11 14:39 ` [PATCH 2/2] vhost-scsi: Improve error handling in vhost_scsi_make_nexus and tpg Alok Tiwari
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alok Tiwari @ 2025-06-11 14:39 UTC (permalink / raw)
  To: mst, jasowang, michael.christie, pbonzini, stefanha, eperezma,
	virtualization, kvm
  Cc: alok.a.tiwari, darren.kenny, netdev, linux-kernel

This patch corrects several minor typos and formatting issues.
Changes include:

Fixing misspellings like in comments
- "explict" -> "explicit"
- "infight" -> "inflight",
- "with generate" -> "will generate"

formatting in logs
- Correcting log formatting specifier from "%dd" to "%d"
- Adding a missing space in the sysfs emit string to prevent
  misinterpreted output like "X86_64on ". changing to "X86_64 on "
- Cleaning up stray semicolons in struct definition endings

These changes improve code readability and consistency.
no functionality changes.

Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/vhost/scsi.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index c12a0d4e6386..508ff3b29f39 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -152,7 +152,7 @@ struct vhost_scsi_nexus {
 struct vhost_scsi_tpg {
 	/* Vhost port target portal group tag for TCM */
 	u16 tport_tpgt;
-	/* Used to track number of TPG Port/Lun Links wrt to explict I_T Nexus shutdown */
+	/* Used to track number of TPG Port/Lun Links wrt to explicit I_T Nexus shutdown */
 	int tv_tpg_port_count;
 	/* Used for vhost_scsi device reference to tpg_nexus, protected by tv_tpg_mutex */
 	int tv_tpg_vhost_count;
@@ -311,12 +311,12 @@ static void vhost_scsi_init_inflight(struct vhost_scsi *vs,
 
 		mutex_lock(&vq->mutex);
 
-		/* store old infight */
+		/* store old inflight */
 		idx = vs->vqs[i].inflight_idx;
 		if (old_inflight)
 			old_inflight[i] = &vs->vqs[i].inflights[idx];
 
-		/* setup new infight */
+		/* setup new inflight */
 		vs->vqs[i].inflight_idx = idx ^ 1;
 		new_inflight = &vs->vqs[i].inflights[idx ^ 1];
 		kref_init(&new_inflight->kref);
@@ -1249,7 +1249,7 @@ vhost_scsi_setup_resp_iovs(struct vhost_scsi_cmd *cmd, struct iovec *in_iovs,
 	if (!in_iovs_cnt)
 		return 0;
 	/*
-	 * Initiator's normally just put the virtio_scsi_cmd_resp in the first
+	 * Initiators normally just put the virtio_scsi_cmd_resp in the first
 	 * iov, but just in case they wedged in some data with it we check for
 	 * greater than or equal to the response struct.
 	 */
@@ -1457,7 +1457,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
 		cmd = vhost_scsi_get_cmd(vq, tag);
 		if (IS_ERR(cmd)) {
 			ret = PTR_ERR(cmd);
-			vq_err(vq, "vhost_scsi_get_tag failed %dd\n", ret);
+			vq_err(vq, "vhost_scsi_get_tag failed %d\n", ret);
 			goto err;
 		}
 		cmd->tvc_vq = vq;
@@ -2609,7 +2609,7 @@ static int vhost_scsi_make_nexus(struct vhost_scsi_tpg *tpg,
 		return -ENOMEM;
 	}
 	/*
-	 * Since we are running in 'demo mode' this call with generate a
+	 * Since we are running in 'demo mode' this call will generate a
 	 * struct se_node_acl for the vhost_scsi struct se_portal_group with
 	 * the SCSI Initiator port name of the passed configfs group 'name'.
 	 */
@@ -2915,7 +2915,7 @@ static ssize_t
 vhost_scsi_wwn_version_show(struct config_item *item, char *page)
 {
 	return sysfs_emit(page, "TCM_VHOST fabric module %s on %s/%s"
-		"on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname,
+		" on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname,
 		utsname()->machine);
 }
 
@@ -2983,13 +2983,13 @@ static int __init vhost_scsi_init(void)
 	vhost_scsi_deregister();
 out:
 	return ret;
-};
+}
 
 static void vhost_scsi_exit(void)
 {
 	target_unregister_template(&vhost_scsi_ops);
 	vhost_scsi_deregister();
-};
+}
 
 MODULE_DESCRIPTION("VHOST_SCSI series fabric driver");
 MODULE_ALIAS("tcm_vhost");
-- 
2.47.1


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

* [PATCH 2/2] vhost-scsi: Improve error handling in vhost_scsi_make_nexus and tpg
  2025-06-11 14:39 [PATCH 1/2] vhost-scsi: Fix typos and formatting in comments and logs Alok Tiwari
@ 2025-06-11 14:39 ` Alok Tiwari
  2025-06-11 18:17   ` Stefan Hajnoczi
  2025-06-12  2:29   ` michael.christie
  2025-06-11 18:09 ` [PATCH 1/2] vhost-scsi: Fix typos and formatting in comments and logs Stefan Hajnoczi
  2025-06-12  2:30 ` michael.christie
  2 siblings, 2 replies; 6+ messages in thread
From: Alok Tiwari @ 2025-06-11 14:39 UTC (permalink / raw)
  To: mst, jasowang, michael.christie, pbonzini, stefanha, eperezma,
	virtualization, kvm
  Cc: alok.a.tiwari, darren.kenny, netdev, linux-kernel

Use PTR_ERR to return the actual error code when vhost_scsi_make_nexus
fails to create a session, instead of returning -ENOMEM.
This ensures more accurate error propagation.

Replace NULL with ERR_PTR(ret) in vhost_scsi_make_tpg to follow kernel
conventions for pointer-returning functions, allowing callers to use
IS_ERR and PTR_ERR for proper error handling.

Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/vhost/scsi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 508ff3b29f39..fd9e435d28bf 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -2594,6 +2594,7 @@ static int vhost_scsi_make_nexus(struct vhost_scsi_tpg *tpg,
 				const char *name)
 {
 	struct vhost_scsi_nexus *tv_nexus;
+	int ret;
 
 	mutex_lock(&tpg->tv_tpg_mutex);
 	if (tpg->tpg_nexus) {
@@ -2617,9 +2618,10 @@ static int vhost_scsi_make_nexus(struct vhost_scsi_tpg *tpg,
 					TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS,
 					(unsigned char *)name, tv_nexus, NULL);
 	if (IS_ERR(tv_nexus->tvn_se_sess)) {
+		ret = PTR_ERR(tv_nexus->tvn_se_sess);
 		mutex_unlock(&tpg->tv_tpg_mutex);
 		kfree(tv_nexus);
-		return -ENOMEM;
+		return ret;
 	}
 	tpg->tpg_nexus = tv_nexus;
 
@@ -2810,7 +2812,7 @@ vhost_scsi_make_tpg(struct se_wwn *wwn, const char *name)
 	ret = core_tpg_register(wwn, &tpg->se_tpg, tport->tport_proto_id);
 	if (ret < 0) {
 		kfree(tpg);
-		return NULL;
+		return ERR_PTR(ret);
 	}
 	mutex_lock(&vhost_scsi_mutex);
 	list_add_tail(&tpg->tv_tpg_list, &vhost_scsi_list);
-- 
2.47.1


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

* Re: [PATCH 1/2] vhost-scsi: Fix typos and formatting in comments and logs
  2025-06-11 14:39 [PATCH 1/2] vhost-scsi: Fix typos and formatting in comments and logs Alok Tiwari
  2025-06-11 14:39 ` [PATCH 2/2] vhost-scsi: Improve error handling in vhost_scsi_make_nexus and tpg Alok Tiwari
@ 2025-06-11 18:09 ` Stefan Hajnoczi
  2025-06-12  2:30 ` michael.christie
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2025-06-11 18:09 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: mst, jasowang, michael.christie, pbonzini, eperezma,
	virtualization, kvm, darren.kenny, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

On Wed, Jun 11, 2025 at 07:39:21AM -0700, Alok Tiwari wrote:
> This patch corrects several minor typos and formatting issues.
> Changes include:
> 
> Fixing misspellings like in comments
> - "explict" -> "explicit"
> - "infight" -> "inflight",
> - "with generate" -> "will generate"
> 
> formatting in logs
> - Correcting log formatting specifier from "%dd" to "%d"
> - Adding a missing space in the sysfs emit string to prevent
>   misinterpreted output like "X86_64on ". changing to "X86_64 on "
> - Cleaning up stray semicolons in struct definition endings
> 
> These changes improve code readability and consistency.
> no functionality changes.
> 
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
> ---
>  drivers/vhost/scsi.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 2/2] vhost-scsi: Improve error handling in vhost_scsi_make_nexus and tpg
  2025-06-11 14:39 ` [PATCH 2/2] vhost-scsi: Improve error handling in vhost_scsi_make_nexus and tpg Alok Tiwari
@ 2025-06-11 18:17   ` Stefan Hajnoczi
  2025-06-12  2:29   ` michael.christie
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2025-06-11 18:17 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: mst, jasowang, michael.christie, pbonzini, eperezma,
	virtualization, kvm, darren.kenny, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 654 bytes --]

On Wed, Jun 11, 2025 at 07:39:22AM -0700, Alok Tiwari wrote:
> Use PTR_ERR to return the actual error code when vhost_scsi_make_nexus
> fails to create a session, instead of returning -ENOMEM.
> This ensures more accurate error propagation.
> 
> Replace NULL with ERR_PTR(ret) in vhost_scsi_make_tpg to follow kernel
> conventions for pointer-returning functions, allowing callers to use
> IS_ERR and PTR_ERR for proper error handling.
> 
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
> ---
>  drivers/vhost/scsi.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 2/2] vhost-scsi: Improve error handling in vhost_scsi_make_nexus and tpg
  2025-06-11 14:39 ` [PATCH 2/2] vhost-scsi: Improve error handling in vhost_scsi_make_nexus and tpg Alok Tiwari
  2025-06-11 18:17   ` Stefan Hajnoczi
@ 2025-06-12  2:29   ` michael.christie
  1 sibling, 0 replies; 6+ messages in thread
From: michael.christie @ 2025-06-12  2:29 UTC (permalink / raw)
  To: Alok Tiwari, mst, jasowang, pbonzini, stefanha, eperezma,
	virtualization, kvm
  Cc: darren.kenny, netdev, linux-kernel

On 6/11/25 9:39 AM, Alok Tiwari wrote:
> Use PTR_ERR to return the actual error code when vhost_scsi_make_nexus
> fails to create a session, instead of returning -ENOMEM.
> This ensures more accurate error propagation.
> 
> Replace NULL with ERR_PTR(ret) in vhost_scsi_make_tpg to follow kernel
> conventions for pointer-returning functions, allowing callers to use
> IS_ERR and PTR_ERR for proper error handling.
> 
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>

Reviewed-by: Mike Christie <michael.christie@oracle.com>

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

* Re: [PATCH 1/2] vhost-scsi: Fix typos and formatting in comments and logs
  2025-06-11 14:39 [PATCH 1/2] vhost-scsi: Fix typos and formatting in comments and logs Alok Tiwari
  2025-06-11 14:39 ` [PATCH 2/2] vhost-scsi: Improve error handling in vhost_scsi_make_nexus and tpg Alok Tiwari
  2025-06-11 18:09 ` [PATCH 1/2] vhost-scsi: Fix typos and formatting in comments and logs Stefan Hajnoczi
@ 2025-06-12  2:30 ` michael.christie
  2 siblings, 0 replies; 6+ messages in thread
From: michael.christie @ 2025-06-12  2:30 UTC (permalink / raw)
  To: Alok Tiwari, mst, jasowang, pbonzini, stefanha, eperezma,
	virtualization, kvm
  Cc: darren.kenny, netdev, linux-kernel

On 6/11/25 9:39 AM, Alok Tiwari wrote:
> This patch corrects several minor typos and formatting issues.
> Changes include:
> 
> Fixing misspellings like in comments
> - "explict" -> "explicit"
> - "infight" -> "inflight",
> - "with generate" -> "will generate"
> 
> formatting in logs
> - Correcting log formatting specifier from "%dd" to "%d"
> - Adding a missing space in the sysfs emit string to prevent
>   misinterpreted output like "X86_64on ". changing to "X86_64 on "
> - Cleaning up stray semicolons in struct definition endings
> 
> These changes improve code readability and consistency.
> no functionality changes.
> 
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>

Reviewed-by: Mike Christie <michael.christie@oracle.com>

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

end of thread, other threads:[~2025-06-12  2:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 14:39 [PATCH 1/2] vhost-scsi: Fix typos and formatting in comments and logs Alok Tiwari
2025-06-11 14:39 ` [PATCH 2/2] vhost-scsi: Improve error handling in vhost_scsi_make_nexus and tpg Alok Tiwari
2025-06-11 18:17   ` Stefan Hajnoczi
2025-06-12  2:29   ` michael.christie
2025-06-11 18:09 ` [PATCH 1/2] vhost-scsi: Fix typos and formatting in comments and logs Stefan Hajnoczi
2025-06-12  2:30 ` michael.christie

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).