Skip to content

Commit 9a580f2

Browse files
bvanasschejfvogel
authored andcommitted
nvme-pci: check kstrtoint() return value in queue_count_set()
This patch avoids that the compiler complains about 'ret' being set but not being used when building with W=1. Fixes: 3b6592f ("nvme: utilize two queue maps, one for reads and one for writes") # v5.0-rc1 Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> (cherry picked from commit e895fed) Conflicts: drivers/nvme/host/pci.c Orabug: 29933720 Signed-off-by: Alan Adamson <[email protected]> Reviewed-by: John Donnelly <[email protected]>
1 parent b3397c2 commit 9a580f2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/nvme/host/pci.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ static int io_queue_depth_set(const char *val, const struct kernel_param *kp)
135135
return param_set_int(val, kp);
136136
}
137137

138+
static int queue_count_set(const char *val, const struct kernel_param *kp)
139+
{
140+
int n = 0, ret;
141+
142+
ret = kstrtoint(val, 10, &n);
143+
if (ret)
144+
return ret;
145+
if (n > num_possible_cpus())
146+
n = num_possible_cpus();
147+
148+
return param_set_int(val, kp);
149+
}
150+
138151
static inline unsigned int sq_idx(unsigned int qid, u32 stride)
139152
{
140153
return qid * 2 * stride;

0 commit comments

Comments
 (0)