linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] maiblox: mediatek: Fix handling of platform_get_irq() error
@ 2020-08-27  7:31 Krzysztof Kozlowski
  2020-08-27 13:57 ` Aw: " Frank Wunderlich
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27  7:31 UTC (permalink / raw)
  To: Jassi Brar, Matthias Brugger, HS Liao, Houlong Wei, CK Hu,
	linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Krzysztof Kozlowski

platform_get_irq() returns -ERRNO on error.  In such case casting to u32
and comparing to 0 would pass the check.

Fixes: 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Changes since v1:
1. Correct u32->int,
2. Fix left-over '!'.
---
 drivers/mailbox/mtk-cmdq-mailbox.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
index 484d4438cd83..5665b6ea8119 100644
--- a/drivers/mailbox/mtk-cmdq-mailbox.c
+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
@@ -69,7 +69,7 @@ struct cmdq_task {
 struct cmdq {
 	struct mbox_controller	mbox;
 	void __iomem		*base;
-	u32			irq;
+	int			irq;
 	u32			thread_nr;
 	u32			irq_mask;
 	struct cmdq_thread	*thread;
@@ -525,10 +525,8 @@ static int cmdq_probe(struct platform_device *pdev)
 	}
 
 	cmdq->irq = platform_get_irq(pdev, 0);
-	if (!cmdq->irq) {
-		dev_err(dev, "failed to get irq\n");
-		return -EINVAL;
-	}
+	if (cmdq->irq < 0)
+		return cmdq->irq;
 
 	plat_data = (struct gce_plat *)of_device_get_match_data(dev);
 	if (!plat_data) {
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Aw: [PATCH v2] maiblox: mediatek: Fix handling of platform_get_irq() error
  2020-08-27  7:31 [PATCH v2] maiblox: mediatek: Fix handling of platform_get_irq() error Krzysztof Kozlowski
@ 2020-08-27 13:57 ` Frank Wunderlich
  2020-08-27 18:23   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Wunderlich @ 2020-08-27 13:57 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jassi Brar, linux-kernel, Houlong Wei, HS Liao, CK Hu,
	linux-mediatek, Krzysztof Kozlowski, Matthias Brugger,
	linux-arm-kernel

> Gesendet: Donnerstag, 27. August 2020 um 09:31 Uhr
> Von: "Krzysztof Kozlowski" <krzk@kernel.org>
> Betreff: [PATCH v2] maiblox: mediatek: Fix handling of platform_get_irq() error

typo in subject i guess it should be "mailbox"

regards Frank

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] maiblox: mediatek: Fix handling of platform_get_irq() error
  2020-08-27 13:57 ` Aw: " Frank Wunderlich
@ 2020-08-27 18:23   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 18:23 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: Jassi Brar, linux-kernel, Houlong Wei, HS Liao, CK Hu,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

On Thu, Aug 27, 2020 at 03:57:55PM +0200, Frank Wunderlich wrote:
> > Gesendet: Donnerstag, 27. August 2020 um 09:31 Uhr
> > Von: "Krzysztof Kozlowski" <krzk@kernel.org>
> > Betreff: [PATCH v2] maiblox: mediatek: Fix handling of platform_get_irq() error
> 
> typo in subject i guess it should be "mailbox"

Indeed, thanks.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-08-27 18:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27  7:31 [PATCH v2] maiblox: mediatek: Fix handling of platform_get_irq() error Krzysztof Kozlowski
2020-08-27 13:57 ` Aw: " Frank Wunderlich
2020-08-27 18:23   ` Krzysztof Kozlowski

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