linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon (occ): Fix response length in checksum retry
@ 2022-07-20 19:30 Eddie James
  2022-07-21  3:46 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Eddie James @ 2022-07-20 19:30 UTC (permalink / raw)
  To: linux; +Cc: linux-hwmon, linux-kernel, jdelvare, 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")
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 drivers/hwmon/occ/p9_sbe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c
index 4a1fe4ee8e2c..f3791a589b01 100644
--- a/drivers/hwmon/occ/p9_sbe.c
+++ b/drivers/hwmon/occ/p9_sbe.c
@@ -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) {
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwmon (occ): Fix response length in checksum retry
  2022-07-20 19:30 [PATCH] hwmon (occ): Fix response length in checksum retry Eddie James
@ 2022-07-21  3:46 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2022-07-21  3:46 UTC (permalink / raw)
  To: Eddie James; +Cc: linux-hwmon, linux-kernel, jdelvare

On Wed, Jul 20, 2022 at 02:30:36PM -0500, Eddie James wrote:
> 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")
> Signed-off-by: Eddie James <eajames@linux.ibm.com>

Acked-by: Guenter Roeck <linux@roeck-us.net>

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

> ---
>  drivers/hwmon/occ/p9_sbe.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c
> index 4a1fe4ee8e2c..f3791a589b01 100644
> --- a/drivers/hwmon/occ/p9_sbe.c
> +++ b/drivers/hwmon/occ/p9_sbe.c
> @@ -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) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-21  3:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20 19:30 [PATCH] hwmon (occ): Fix response length in checksum retry Eddie James
2022-07-21  3:46 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).