mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 06:02:33 +00:00
scst_lib: Preserve the error pointer with ERR_CAST
Coccinelle api/err_cast.cocci reports: scst/src/scst_lib.c:8710:8-15: WARNING: ERR_CAST can be used with bw blk_copy_kern_sg returns an error pointer on failure. Its caller, blk_map_kern_sg, converts that value to an integer with PTR_ERR and immediately back to a pointer with ERR_PTR. Assign ERR_CAST(bw) to rq instead. It expresses propagation of the same error pointer to the request-pointer return type without the redundant pointer-to-integer round trip.
This commit is contained in:
+1
-1
@@ -8709,7 +8709,7 @@ static struct request *blk_map_kern_sg(struct request_queue *q,
|
||||
|
||||
bw = blk_copy_kern_sg(q, sgl, nents, gfp, reading);
|
||||
if (IS_ERR(bw)) {
|
||||
rq = ERR_PTR(PTR_ERR(bw));
|
||||
rq = ERR_CAST(bw);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user