fsi: occ: Fix checksum failure mode
authorEddie James <eajames@linux.ibm.com>
Tue, 26 Apr 2022 15:49:55 +0000 (10:49 -0500)
committerJoel Stanley <joel@jms.id.au>
Tue, 27 Sep 2022 07:27:17 +0000 (16:57 +0930)
Change the checksum errno to something different than the errno
used for a bad SBE message. In addition, don't set the user's
response length to the data length in this case, since it's not
SBE FFDC.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/20220426154956.27205-2-eajames@linux.ibm.com
Signed-off-by: Joel Stanley <joel@jms.id.au>
drivers/fsi/fsi-occ.c

index c9cc75fbdfb9d4aef75f1137a75ccfdd8c620000..3d04e8baecbbd6e305a68ba2828f6a425fd4de09 100644 (file)
@@ -246,7 +246,7 @@ static int occ_verify_checksum(struct occ *occ, struct occ_response *resp,
        if (checksum != checksum_resp) {
                dev_err(occ->dev, "Bad checksum: %04x!=%04x\n", checksum,
                        checksum_resp);
-               return -EBADMSG;
+               return -EBADE;
        }
 
        return 0;
@@ -575,8 +575,11 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len,
        dev_dbg(dev, "resp_status=%02x resp_data_len=%d\n",
                resp->return_status, resp_data_length);
 
-       occ->client_response_size = resp_data_length + 7;
        rc = occ_verify_checksum(occ, resp, resp_data_length);
+       if (rc)
+               goto done;
+
+       occ->client_response_size = resp_data_length + 7;
 
  done:
        *resp_len = occ->client_response_size;