OSDN Git Service

greybus: es1: test apb1_log_task safely
authorAlex Elder <elder@linaro.org>
Fri, 27 Mar 2015 20:20:49 +0000 (15:20 -0500)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 30 Mar 2015 13:28:13 +0000 (15:28 +0200)
commitdada3b02a38c2e1d06a43d0d909d48f4db798dfc
tree6a423d61e5ca75692edc8c1eb8a179ef34c52154
parentd8187aa2241136e9fb3801e82fe8c2dfdae06802
greybus: es1: test apb1_log_task safely

When usb_log_enable() is called, the global apb1_log_task is used to
hold the result of kthread_run().  It is possible for kthread_run()
to return an error pointer, so tests of apb_log_task against NULL
are insufficient to determine its validity.

Note that kthread_run() never returns NULL so we don't have to check
for that.  But apb1_log_task is initially NULL, so that global must
be both non-null and not an error in order to be considered valid.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/es1.c