linux-kernel.vger.kernel.org archive mirror
 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 related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER
  2019-02-22 19:29 [PATCH 1/2] habanalabs: don't print result when rc indicates error Oded Gabbay
@ 2019-02-22 19:29 ` Oded Gabbay
  2019-02-23  9:16   ` Greg KH
  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

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).

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
---
 drivers/misc/habanalabs/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/misc/habanalabs/Kconfig b/drivers/misc/habanalabs/Kconfig
index b7f38a14caf5..80400a035dc1 100644
--- a/drivers/misc/habanalabs/Kconfig
+++ b/drivers/misc/habanalabs/Kconfig
@@ -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.
-- 
2.18.0


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

* Re: [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2019-02-23  9:16 UTC (permalink / raw)
  To: Oded Gabbay; +Cc: linux-kernel, dan.carpenter

On Fri, Feb 22, 2019 at 09:29:59PM +0200, Oded Gabbay wrote:
> 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).
> 
> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>

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

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

* Re: [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER
  2019-02-23  9:16   ` Greg KH
@ 2019-02-23  9:19     ` Oded Gabbay
  2019-02-23  9:34       ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Oded Gabbay @ 2019-02-23  9:19 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux-Kernel@Vger. Kernel. Org, Dan Carpenter

On Sat, Feb 23, 2019 at 11:17 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Fri, Feb 22, 2019 at 09:29:59PM +0200, Oded Gabbay wrote:
> > 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).
> >
> > Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
>
> 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

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

* Re: [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER
  2019-02-23  9:19     ` Oded Gabbay
@ 2019-02-23  9:34       ` Greg KH
  2019-02-23  9:51         ` Oded Gabbay
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2019-02-23  9:34 UTC (permalink / raw)
  To: Oded Gabbay; +Cc: Linux-Kernel@Vger. Kernel. Org, Dan Carpenter

On Sat, Feb 23, 2019 at 11:19:07AM +0200, Oded Gabbay wrote:
> On Sat, Feb 23, 2019 at 11:17 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Fri, Feb 22, 2019 at 09:29:59PM +0200, Oded Gabbay wrote:
> > > 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).
> > >
> > > Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
> >
> > 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 :(

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

* Re: [PATCH 2/2] habanalabs: driver's Kconfig must select DMA_SHARED_BUFFER
  2019-02-23  9:34       ` Greg KH
@ 2019-02-23  9:51         ` Oded Gabbay
  0 siblings, 0 replies; 6+ messages in thread
From: Oded Gabbay @ 2019-02-23  9:51 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux-Kernel@Vger. Kernel. Org, Dan Carpenter

On Sat, Feb 23, 2019 at 11:34 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Feb 23, 2019 at 11:19:07AM +0200, Oded Gabbay wrote:
> > On Sat, Feb 23, 2019 at 11:17 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Fri, Feb 22, 2019 at 09:29:59PM +0200, Oded Gabbay wrote:
> > > > 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).
> > > >
> > > > Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
> > >
> > > 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 :(
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

^ 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;
as well as URLs for NNTP newsgroup(s).