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:
Gleb Chesnokov
2026-10-20 18:02:29 +03:00
parent 92b9fc02cc
commit 4b6627b4ca
+1 -1
View File
@@ -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;
}