Skip to contentSkip to conversation

scsi: sg: return -ENOMEM on out of memory error

PATCH In review Colin King 2 participants 2 messages Mar 11, 2021 – Mar 12, 2021

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 scsi: sg: return -ENOMEM on out of memory error

From: Colin Ian King <[email protected]>

The sg_proc_seq_show_debug should return -ENOMEM on an out of memory error rather than -1. Fix this.

Fixes 94cda6cf2e44 ("scsi: sg: Rework debug info")
---
 drivers/scsi/sg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sg.c +1 -1
index 79f05afa4407..85e86cbc6891 100644
@@ -4353,7 +4353,7 @@ sg_proc_seq_show_debug(struct seq_file *s, void *v)
 	if (!bp) {
 		seq_printf(s, "%s: Unable to allocate %d on heap, finish\n",
 			   __func__, bp_len);
-		return -1;
+		return -ENOMEM;
 	}
 	read_lock_irqsave(&sg_index_lock, iflags);
 	sdp = it ? sg_lookup_dev(it->index) : NULL;
Signature · 1 line
2.30.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Colin King

From: Colin Ian King <[email protected]>

The sg_proc_seq_show_debug should return -ENOMEM on an out of memory error rather than -1. Fix this.

Fixes 94cda6cf2e44 ("scsi: sg: Rework debug info")

Thanks.

Quoted 18 lines
---
  drivers/scsi/sg.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sg.c +1 -1
index 79f05afa4407..85e86cbc6891 100644
@@ -4353,7 +4353,7 @@ sg_proc_seq_show_debug(struct seq_file *s, void *v)
  	if (!bp) {
  		seq_printf(s, "%s: Unable to allocate %d on heap, finish\n",
  			   __func__, bp_len);
-		return -1;
+		return -ENOMEM;
  	}
  	read_lock_irqsave(&sg_index_lock, iflags);
  	sdp = it ? sg_lookup_dev(it->index) : NULL;