All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joseph Wright <rjosephwright@gmail.com>
To: gregkh@linuxfoundation.org, linux@Wolf-Entwicklungen.de
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Joseph Wright <rjosephwright@gmail.com>
Subject: [PATCH 2/2] Staging: pi433: check error after kthread_run()
Date: Sun, 16 Jul 2017 14:48:58 +0000	[thread overview]
Message-ID: <20170716144858.643-3-rjosephwright@gmail.com> (raw)
In-Reply-To: <20170716144858.643-1-rjosephwright@gmail.com>

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

  parent reply	other threads:[~2017-07-19  3:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Joseph Wright [this message]
2017-07-19 19:41   ` [PATCH 2/2] Staging: pi433: check error after kthread_run() Marcus Wolf
2017-07-20 11:05   ` Wolf Entwicklungen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170716144858.643-3-rjosephwright@gmail.com \
    --to=rjosephwright@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@Wolf-Entwicklungen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.