mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] habanalabs: don't print result when rc indicates error
@ 2019-02-22 19:29 Oded Gabbay
  2019-02-22 19:29 ` [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER Oded Gabbay
  0 siblings, 1 reply; 6+ messages in thread
From: Oded Gabbay @ 2019-02-22 19:29 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: dan.carpenter

send_cpu_message() doesn't update the result parameter when an error
occurs in its code. Therefore, callers of send_cpu_message() shouldn't use
the result value when the return code indicates error.

This patch fixes a static checker warning in goya_test_cpu_queue(), where
that function did print the result even though the return code from
send_cpu_message() indicated error.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
---
 drivers/misc/habanalabs/goya/goya.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
index c43bd37fe693..e6f0d49ab71a 100644
--- a/drivers/misc/habanalabs/goya/goya.c
+++ b/drivers/misc/habanalabs/goya/goya.c
@@ -3380,10 +3380,16 @@ int goya_test_cpu_queue(struct hl_device *hdev)
 	rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &test_pkt,
 			sizeof(test_pkt), HL_DEVICE_TIMEOUT_USEC, &result);
 
-	if (!rc)
-		dev_info(hdev->dev, "queue test on CPU queue succeeded\n");
-	else
-		dev_err(hdev->dev, "CPU queue test failed (0x%08lX)\n", result);
+	if (!rc) {
+		if (result == ARMCP_PACKET_FENCE_VAL)
+			dev_info(hdev->dev,
+				"queue test on CPU queue succeeded\n");
+		else
+			dev_err(hdev->dev,
+				"CPU queue test failed (0x%08lX)\n", result);
+	} else {
+		dev_err(hdev->dev, "CPU queue test failed, error %d\n", rc);
+	}
 
 	return rc;
 }
-- 
2.18.0


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

end of thread, other threads:[~2019-02-23  9:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22 19:29 [PATCH 1/2] habanalabs: don't print result when rc indicates error Oded Gabbay
2019-02-22 19:29 ` [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER Oded Gabbay
2019-02-23  9:16   ` Greg KH
2019-02-23  9:19     ` Oded Gabbay
2019-02-23  9:34       ` Greg KH
2019-02-23  9:51         ` Oded Gabbay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome