OSDN Git Service

greybus: es2: 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:29:02 +0000 (15:29 +0200)
commite0feaf14b102f767d00ee28443f8443e4d76ba8b
treea74b06e7fbd27b450762f48de1364286736820ed
parentdada3b02a38c2e1d06a43d0d909d48f4db798dfc
greybus: es2: 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/es2.c