block: wrong return value
PATCH v3 1/1 block: wrong return value
while compiling integer err was showing as a set but unused variable. elevator_init_fn can be either cfq_init_queue or deadline_init_queue or noop_init_queue.
all three of these functions are returning -ENOMEM if they fail to allocate the queue.
so we should actually be returning the error code rather than returning 0 always.
---
change in v2: added elevator_put
change in v3: remove unneeded initialization of err
block/elevator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
block/elevator.c +3 -1
@@ -229,7 +229,9 @@ int elevator_init(struct request_queue *q, char *name) } err = e->ops.elevator_init_fn (q, e); -return 0 ; +if (err) +elevator_put (e); +return err; }EXPORT_SYMBOL (elevator_init);
Signature · 1 line
1.8.1.2
Quoted 7 lines · Sudip Mukherjee
while compiling integer err was showing as a set but unused variable.
elevator_init_fncan be eithercfq_init_queueordeadline_init_queueornoop_init_queue.
all three of these functions are returning-ENOMEMif they fail to allocate the queue.
so we should actually be returning the error code rather than returning 0 always.
i have one doubt. shouldn't this patch be marked for stable also?
thanks
sudip
Quoted 28 lines
Signed-off-by Sudip Mukherjee <[email protected]>---
change in v2: added
elevator_put
change in v3: remove unneeded initialization of errblock/elevator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)block/elevator.c +3
-1@@ -229,7 +229,9 @@ int elevator_init(struct request_queue *q, char *name) } err = e->ops.elevator_init_fn (q, e); -return 0 ; +if (err) +elevator_put (e); +return err; }EXPORT_SYMBOL (elevator_init);Signature · 1 line
1.8.1.2
Jens Axboe
maintainerQuoted 9 lines · Sudip Mukherjee
Quoted 7 lines · Sudip Mukherjee
while compiling integer err was showing as a set but unused variable.
elevator_init_fncan be eithercfq_init_queueordeadline_init_queueornoop_init_queue.
all three of these functions are returning-ENOMEMif they fail to allocate the queue.
so we should actually be returning the error code rather than returning 0 always.i have one doubt. shouldn't this patch be marked for stable also?
It would not hurt to mark it as stable, but on the other hand, this probably never triggered a problem for anyone. So it's not a critical fix by any stretch.
Signature · 1 line
Jens Axboe