powerpc/powernv/opal-dump : Handles opal_dump_info properly
authorMukesh Ojha <mukesh02@linux.vnet.ibm.com>
Mon, 20 Feb 2017 13:22:10 +0000 (18:52 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 24 Jul 2018 12:03:23 +0000 (22:03 +1000)
Moves the return value check of 'opal_dump_info' to a proper place which
was previously unnecessarily filling all the dump info even on failure.

Signed-off-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com>
Acked-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/powernv/opal-dump.c

index 0dc8fa4e0af2a9d0015c3e8ad654e9280454e5b1..a792966ab0f27d4192d0b542c0c437d34e4d3a4e 100644 (file)
@@ -225,13 +225,16 @@ static int64_t dump_read_info(uint32_t *dump_id, uint32_t *dump_size, uint32_t *
        if (rc == OPAL_PARAMETER)
                rc = opal_dump_info(&id, &size);
 
+       if (rc) {
+               pr_warn("%s: Failed to get dump info (%d)\n",
+                       __func__, rc);
+               return rc;
+       }
+
        *dump_id = be32_to_cpu(id);
        *dump_size = be32_to_cpu(size);
        *dump_type = be32_to_cpu(type);
 
-       if (rc)
-               pr_warn("%s: Failed to get dump info (%d)\n",
-                       __func__, rc);
        return rc;
 }