All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Staging: pi433: fix sparse warnings
@ 2017-07-16 14:48 Joseph Wright
  2017-07-16 14:48 ` [PATCH 1/2] Staging: pi433: declare functions static Joseph Wright
  2017-07-16 14:48 ` [PATCH 2/2] Staging: pi433: check error after kthread_run() Joseph Wright
  0 siblings, 2 replies; 6+ messages in thread
From: Joseph Wright @ 2017-07-16 14:48 UTC (permalink / raw)
  To: gregkh, linux; +Cc: devel, linux-kernel, Joseph Wright

Two patches included to fix warnings found with sparse.

Joseph Wright (2):
  Staging: pi433: declare functions static
  Staging: pi433: check error after kthread_run()

 drivers/staging/pi433/pi433_if.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.9.3

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

* [PATCH 1/2] Staging: pi433: declare functions static
  2017-07-16 14:48 [PATCH 0/2] Staging: pi433: fix sparse warnings Joseph Wright
@ 2017-07-16 14:48 ` Joseph Wright
  2017-07-20 11:04   ` Wolf Entwicklungen
  2017-07-16 14:48 ` [PATCH 2/2] Staging: pi433: check error after kthread_run() Joseph Wright
  1 sibling, 1 reply; 6+ messages in thread
From: Joseph Wright @ 2017-07-16 14:48 UTC (permalink / raw)
  To: gregkh, linux; +Cc: devel, linux-kernel, Joseph Wright

Declare functions static to fix sparse warnings:

warning: symbol 'pi433_receive' was not declared. Should it be static?
warning: symbol 'pi433_tx_thread' was not declared. Should it be static?

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

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 1bc478a..46461b4 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -313,7 +313,7 @@ pi433_start_rx(struct pi433_device *dev)
 
 /*-------------------------------------------------------------------------*/
 
-int
+static int
 pi433_receive(void *data)
 {
 	struct pi433_device *dev = data;
@@ -463,7 +463,7 @@ pi433_receive(void *data)
 		return bytes_total;
 }
 
-int
+static int
 pi433_tx_thread(void *data)
 {
 	struct pi433_device *device = data;
-- 
2.9.3

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

* [PATCH 2/2] Staging: pi433: check error after kthread_run()
  2017-07-16 14:48 [PATCH 0/2] Staging: pi433: fix sparse warnings Joseph Wright
  2017-07-16 14:48 ` [PATCH 1/2] Staging: pi433: declare functions static Joseph Wright
@ 2017-07-16 14:48 ` Joseph Wright
  2017-07-19 19:41   ` Marcus Wolf
  2017-07-20 11:05   ` Wolf Entwicklungen
  1 sibling, 2 replies; 6+ messages in thread
From: Joseph Wright @ 2017-07-16 14:48 UTC (permalink / raw)
  To: gregkh, linux; +Cc: devel, linux-kernel, 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

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

* Re: [PATCH 2/2] Staging: pi433: check error after kthread_run()
  2017-07-16 14:48 ` [PATCH 2/2] Staging: pi433: check error after kthread_run() Joseph Wright
@ 2017-07-19 19:41   ` Marcus Wolf
  2017-07-20 11:05   ` Wolf Entwicklungen
  1 sibling, 0 replies; 6+ messages in thread
From: Marcus Wolf @ 2017-07-19 19:41 UTC (permalink / raw)
  To: Joseph Wright, gregkh; +Cc: linux-kernel, devel

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

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

* Re: [PATCH 1/2] Staging: pi433: declare functions static
  2017-07-16 14:48 ` [PATCH 1/2] Staging: pi433: declare functions static Joseph Wright
@ 2017-07-20 11:04   ` Wolf Entwicklungen
  0 siblings, 0 replies; 6+ messages in thread
From: Wolf Entwicklungen @ 2017-07-20 11:04 UTC (permalink / raw)
  To: Joseph Wright; +Cc: gregkh, linux, devel, linux-kernel, Joseph Wright

Reviewed-by: Marcus Wolf <linux@wolf-entwicklungen.de>

Am So, 16.07.2017, 16:48 schrieb Joseph Wright:
> Declare functions static to fix sparse warnings:
>
> warning: symbol 'pi433_receive' was not declared. Should it be static?
> warning: symbol 'pi433_tx_thread' was not declared. Should it be static?
>
> Signed-off-by: Joseph Wright <rjosephwright@gmail.com>
> ---
>  drivers/staging/pi433/pi433_if.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
> index 1bc478a..46461b4 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -313,7 +313,7 @@ pi433_start_rx(struct pi433_device *dev)
>
>  /*-------------------------------------------------------------------------*/
>
> -int
> +static int
>  pi433_receive(void *data)
>  {
>  	struct pi433_device *dev = data;
> @@ -463,7 +463,7 @@ pi433_receive(void *data)
>  		return bytes_total;
>  }
>
> -int
> +static int
>  pi433_tx_thread(void *data)
>  {
>  	struct pi433_device *device = data;
> --
> 2.9.3
>
>
>

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

* Re: [PATCH 2/2] Staging: pi433: check error after kthread_run()
  2017-07-16 14:48 ` [PATCH 2/2] Staging: pi433: check error after kthread_run() Joseph Wright
  2017-07-19 19:41   ` Marcus Wolf
@ 2017-07-20 11:05   ` Wolf Entwicklungen
  1 sibling, 0 replies; 6+ messages in thread
From: Wolf Entwicklungen @ 2017-07-20 11:05 UTC (permalink / raw)
  To: Joseph Wright; +Cc: gregkh, linux, devel, linux-kernel, Joseph Wright

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

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

end of thread, other threads:[~2017-07-20 11:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-16 14:48 [PATCH 0/2] Staging: pi433: fix sparse warnings Joseph Wright
2017-07-16 14:48 ` [PATCH 1/2] Staging: pi433: declare functions static Joseph Wright
2017-07-20 11:04   ` Wolf Entwicklungen
2017-07-16 14:48 ` [PATCH 2/2] Staging: pi433: check error after kthread_run() Joseph Wright
2017-07-19 19:41   ` Marcus Wolf
2017-07-20 11:05   ` Wolf Entwicklungen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.