Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1690932 > unrolled thread

[PATCH 2/2] Staging: pi433: check error after kthread_run()

Started byJoseph Wright <rjosephwright@gmail.com>
First post2017-07-19 05:10 +0200
Last post2017-07-20 13:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] Staging: pi433: check error after kthread_run() Joseph Wright <rjosephwright@gmail.com> - 2017-07-19 05:10 +0200
    Re: [PATCH 2/2] Staging: pi433: check error after kthread_run() Marcus Wolf <marcus.wolf@wolf-entwicklungen.de> - 2017-07-19 21:50 +0200
    Re: [PATCH 2/2] Staging: pi433: check error after kthread_run() "Wolf Entwicklungen" <Marcus.Wolf@Wolf-Entwicklungen.de> - 2017-07-20 13:10 +0200

#1690932 — [PATCH 2/2] Staging: pi433: check error after kthread_run()

FromJoseph Wright <rjosephwright@gmail.com>
Date2017-07-19 05:10 +0200
Subject[PATCH 2/2] Staging: pi433: check error after kthread_run()
Message-ID<u4Nx7-2EI-1@gated-at.bofh.it>
Error should be checked with IS_ERR after calling kthread_run()
instead of comparing the returned pointer to an int.

Found by sparse warning:

incompatible types for operation (<)
    left side has type struct task_struct *tx_task_struct
    right side has type int

Signed-off-by: Joseph Wright <rjosephwright@gmail.com>
---
 drivers/staging/pi433/pi433_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 46461b4..4f724a5 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -1152,7 +1152,7 @@ static int pi433_probe(struct spi_device *spi)
 	device->tx_task_struct = kthread_run(pi433_tx_thread,
 					     device,
 					     "pi433_tx_task");
-	if (device->tx_task_struct < 0)
+	if (IS_ERR(device->tx_task_struct))
 	{
 		dev_dbg(device->dev, "start of send thread failed");
 		goto send_thread_failed;
-- 
2.9.3

[toc] | [next] | [standalone]


#1692158

FromMarcus Wolf <marcus.wolf@wolf-entwicklungen.de>
Date2017-07-19 21:50 +0200
Message-ID<u538T-4JC-33@gated-at.bofh.it>
In reply to#1690932
Hi Joseph,

tested your patch and didn't observe a problem.

Thanks for your help :-)

Marcus

> Joseph Wright <rjosephwright@gmail.com> hat am 16. Juli 2017 um 16:48
> geschrieben:
>
>
> Error should be checked with IS_ERR after calling kthread_run()
> instead of comparing the returned pointer to an int.
>
> Found by sparse warning:
>
> incompatible types for operation (<)
> left side has type struct task_struct *tx_task_struct
> right side has type int
>
> Signed-off-by: Joseph Wright <rjosephwright@gmail.com>
> ---
> drivers/staging/pi433/pi433_if.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/pi433/pi433_if.c
> b/drivers/staging/pi433/pi433_if.c
> index 46461b4..4f724a5 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -1152,7 +1152,7 @@ static int pi433_probe(struct spi_device *spi)
> device->tx_task_struct = kthread_run(pi433_tx_thread,
> device,
> "pi433_tx_task");
> - if (device->tx_task_struct < 0)
> + if (IS_ERR(device->tx_task_struct))
> {
> dev_dbg(device->dev, "start of send thread failed");
> goto send_thread_failed;
> --
> 2.9.3
>
>

[toc] | [prev] | [next] | [standalone]


#1692801

From"Wolf Entwicklungen" <Marcus.Wolf@Wolf-Entwicklungen.de>
Date2017-07-20 13:10 +0200
Message-ID<u5hve-6vT-21@gated-at.bofh.it>
In reply to#1690932
Reviewed-by: Marcus Wolf <linux@wolf-entwicklungen.de>
Tested-by: Marcus Wolf <linux@wolf-entwicklungen.de>

Am So, 16.07.2017, 16:48 schrieb Joseph Wright:
> Error should be checked with IS_ERR after calling kthread_run()
> instead of comparing the returned pointer to an int.
>
> Found by sparse warning:
>
> incompatible types for operation (<)
>     left side has type struct task_struct *tx_task_struct
>     right side has type int
>
> Signed-off-by: Joseph Wright <rjosephwright@gmail.com>
> ---
>  drivers/staging/pi433/pi433_if.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
> index 46461b4..4f724a5 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -1152,7 +1152,7 @@ static int pi433_probe(struct spi_device *spi)
>  	device->tx_task_struct = kthread_run(pi433_tx_thread,
>  					     device,
>  					     "pi433_tx_task");
> -	if (device->tx_task_struct < 0)
> +	if (IS_ERR(device->tx_task_struct))
>  	{
>  		dev_dbg(device->dev, "start of send thread failed");
>  		goto send_thread_failed;
> --
> 2.9.3
>
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web