提交 7d9b62ae 编写于 作者: D David Kozub 提交者: Jens Axboe

block: sed-opal: unify error handling of responses

response_get_{string,u64} include error handling for argument resp being
NULL but response_get_token does not handle this.

Make all three of response_get_{string,u64,token} handle NULL resp in
the same way.
Co-authored-by: NJonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Signed-off-by: NDavid Kozub <zub@linux.fjfi.cvut.cz>
Signed-off-by: NJonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Reviewed-by: NScott Bauer <sbauer@plzdonthack.me>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NJon Derrick <jonathan.derrick@intel.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 e8b29224
......@@ -696,6 +696,11 @@ static const struct opal_resp_tok *response_get_token(
{
const struct opal_resp_tok *tok;
if (!resp) {
pr_debug("Response is NULL\n");
return ERR_PTR(-EINVAL);
}
if (n >= resp->num) {
pr_debug("Token number doesn't exist: %d, resp: %d\n",
n, resp->num);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册