Skip to contentSkip to conversation

habanalabs: don't print result when rc indicates error

PATCH In review Oded Gabbay 2 participants 6 messages Feb 22, 2019 – Feb 23, 2019 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 habanalabs: don't print result when rc indicates error

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.

---
 drivers/misc/habanalabs/goya/goya.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/misc/habanalabs/goya/goya.c +10 -4
index c43bd37fe693..e6f0d49ab71a 100644
@@ -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;
 }
Signature · 1 line
2.18.0
#1 lore raw

PATCH 2/2 habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER

The driver uses the DMA_BUF module which is built only if DMA_SHARED_BUFFER is selected. DMA_SHARED_BUFFER doesn't have any dependencies so it is ok to select it (as done by many other components).

---
 drivers/misc/habanalabs/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/misc/habanalabs/Kconfig +1 -0
index b7f38a14caf5..80400a035dc1 100644
@@ -6,6 +6,7 @@ config HABANA_AI
 	tristate "HabanaAI accelerators (habanalabs)"
 	depends on PCI
 	select FRAME_VECTOR
+	select DMA_SHARED_BUFFER
 	help
 	  Enables PCIe card driver for Habana's AI Processors (AIP) that are
 	  designed to accelerate Deep Learning inference and training workloads.
Signature · 1 line
2.18.0
maintainer
#2 lore raw

Re: [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER

Quoted 5 lines · Oded Gabbay

The driver uses the DMA_BUF module which is built only if DMA_SHARED_BUFFER is selected. DMA_SHARED_BUFFER doesn't have any dependencies so it is ok to select it (as done by many other components).

kbuild reported this, right? You should always add that type of credit to the patch. I'll go add it by hand this time...

thanks,

greg k-h

#3 lore raw

Re: [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER

Quoted 6 lines · Greg KH
Quoted 4 lines · Oded Gabbay

The driver uses the DMA_BUF module which is built only if DMA_SHARED_BUFFER is selected. DMA_SHARED_BUFFER doesn't have any dependencies so it is ok to select it (as done by many other components).

Quoted 8 lines
Quoted 1 line

kbuild reported this, right? You should always add that type of credit to the patch. I'll go add it by hand this time...

thanks,

greg k-h

Ah, I didn't know that, sorry. It wasn't enforced in drm :( I'll follow your example for future patches. Thanks,
Oded

maintainer
#4 lore raw

Re: [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER

Quoted 9 lines · Oded Gabbay
Quoted 8 lines · Greg KH
Quoted 5 lines · Oded Gabbay

The driver uses the DMA_BUF module which is built only if DMA_SHARED_BUFFER is selected. DMA_SHARED_BUFFER doesn't have any dependencies so it is ok to select it (as done by many other components).

Quoted 8 lines
Quoted 6 lines

kbuild reported this, right? You should always add that type of credit to the patch. I'll go add it by hand this time...

thanks,

greg k-h

Ah, I didn't know that, sorry. It wasn't enforced in drm :(

Really? The drm developers should know better, that's not ok :(

#5 lore raw

Re: [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER

Quoted 14 lines · Greg KH
Quoted 12 lines · Oded Gabbay
Quoted 11 lines · Greg KH
Quoted 5 lines · Oded Gabbay

The driver uses the DMA_BUF module which is built only if DMA_SHARED_BUFFER is selected. DMA_SHARED_BUFFER doesn't have any dependencies so it is ok to select it (as done by many other components).

kbuild reported this, right? You should always add that type of credit to the patch. I'll go add it by hand this time...

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

thanks,

greg k-h

Ah, I didn't know that, sorry. It wasn't enforced in drm :(

Really? The drm developers should know better, that's not ok :(

Well, perhaps it wasn't enforced only for the few instances that I fixed those errors and usually it is enforced.
I don't want to smear the entire drm developers community based on a small set of examples.
Thanks,
Oded