Skip to contentSkip to conversation

block: sed-opal: unify error handling of responses

PATCH Superseded David Kozub 1 participant 1 message Jan 16, 2019

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 6/16 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.

---
 block/sed-opal.c | 5 +++++
 1 file changed, 5 insertions(+)
block/sed-opal.c +5 -0
index e29cb2f445ff..537cd73ea88a 100644
@@ -702,6 +702,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);
Signature · 1 line
2.20.1