ipa: Move the second null check into the first one
Move the second null check before we actually dereference the
msg.
Fixes: Coverity CID 1231854
diff --git a/src/input/ipa.c b/src/input/ipa.c
index eff01ce..e7ae6fb 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -66,14 +66,13 @@
if (msg == NULL) {
msg = ipa_msg_alloc(0);
+ if (msg == NULL) {
+ ret = -ENOMEM;
+ goto discard_msg;
+ }
msg->l1h = msg->tail;
}
- if (msg == NULL) {
- ret = -ENOMEM;
- goto discard_msg;
- }
-
if (msg->l2h == NULL) {
/* first read our 3-byte header */
needed = sizeof(*hh) - msg->len;