Staging: pi433: fix sparse warnings
cover Staging: pi433: fix sparse warnings
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(-)
Signature · 1 line
2.9.3
PATCH 1/2 Staging: pi433: declare functions static
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?
--- drivers/staging/pi433/pi433_if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/pi433/pi433_if.c +2 -2
@@ -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;
Signature · 1 line
2.9.3
Re: [PATCH 1/2] Staging: pi433: declare functions static
Am So, 16.07.2017, 16:48 schrieb Joseph Wright:
Quoted 37 lines
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 <[email protected]>--- drivers/staging/pi433/pi433_if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/pi433/pi433_if.c +2
-3@@ -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
PATCH 2/2 Staging: pi433: check error after kthread_run()
In reply to Joseph WrightError 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
--- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/pi433/pi433_if.c +1 -1
@@ -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;
Signature · 1 line
2.9.3
Re: [PATCH 2/2] Staging: pi433: check error after kthread_run()
Hi Joseph,
tested your patch and didn't observe a problem.
Thanks for your help :-)
Marcus
Quoted 36 lines
Joseph Wright <[email protected]> hat am 16. Juli 2017 um 16:48 geschrieben:
Error should be checked with
IS_ERRafter callingkthread_run()instead of comparing the returned pointer to an int.Found by sparse warning:
incompatible types for operation (<)
left side has type structtask_struct*tx_task_structright side has type intSigned-off-by Joseph Wright <[email protected]>---
drivers/staging/pi433/pi433_if.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/pi433/pi433_if.c +1
-2@@ -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
Re: [PATCH 2/2] Staging: pi433: check error after kthread_run()
In reply to Joseph WrightAm So, 16.07.2017, 16:48 schrieb Joseph Wright:
Quoted 32 lines
Error should be checked with
IS_ERRafter callingkthread_run()instead of comparing the returned pointer to an int.Found by sparse warning:
incompatible types for operation (<)
left side has type structtask_struct*tx_task_structright side has type intSigned-off-by Joseph Wright <[email protected]>--- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/pi433/pi433_if.c +1
-2@@ -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