Skip to content

Commit

Permalink
block: sed-opal: unify error handling of responses
Browse files Browse the repository at this point in the history
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: Jonas Rabenstein <[email protected]>
Signed-off-by: David Kozub <[email protected]>
Signed-off-by: Jonas Rabenstein <[email protected]>
Reviewed-by: Scott Bauer <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Jon Derrick <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
2 people authored and axboe committed Apr 6, 2019
1 parent e8b2922 commit 7d9b62a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions block/sed-opal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7d9b62a

Please sign in to comment.