Skip to contentSkip to conversation

hwmon (occ): Fix response length in checksum retry

PATCH In review Eddie James 2 participants 2 messages Jul 20, 2022 – Jul 21, 2022 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon (occ): Fix response length in checksum retry

Retrying for checksum failure doesn't work since the response length gets zeroed out in the submit function. Fix this by resetting the response length to its original value before the retry.

Fixes c27b98ca0edb ("hwmon (occ): Retry for checksum failure")
---
 drivers/hwmon/occ/p9_sbe.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hwmon/occ/p9_sbe.c +2 -0
index 4a1fe4ee8e2c..f3791a589b01 100644
@@ -82,6 +82,7 @@ static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx, const void *resp,
 static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len,
 			       void *resp, size_t resp_len)
 {
+	size_t original_resp_len = resp_len;
 	struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ);
 	int rc, i;
 
@@ -97,6 +98,7 @@ static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len,
 		}
 		if (rc != -EBADE)
 			return rc;
+		resp_len = original_resp_len;
 	}
 
 	switch (((struct occ_response *)resp)->return_status) {
Signature · 1 line
2.31.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Eddie James

Retrying for checksum failure doesn't work since the response length gets zeroed out in the submit function. Fix this by resetting the response length to its original value before the retry.

Fixes c27b98ca0edb ("hwmon (occ): Retry for checksum failure")

I assume this patch will be applied with the patch introducing the problem. If not, I'll apply it after the next commit window closes.

Thanks,
Guenter

Quoted 24 lines
---
 drivers/hwmon/occ/p9_sbe.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hwmon/occ/p9_sbe.c +2 -0
index 4a1fe4ee8e2c..f3791a589b01 100644
@@ -82,6 +82,7 @@ static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx, const void *resp,
 static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len,
 			       void *resp, size_t resp_len)
 {
+	size_t original_resp_len = resp_len;
 	struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ);
 	int rc, i;
 
@@ -97,6 +98,7 @@ static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len,
 		}
 		if (rc != -EBADE)
 			return rc;
+		resp_len = original_resp_len;
 	}
 
 	switch (((struct occ_response *)resp)->return_status) {