OSDN Git Service

coresight: stm: return error code instead of zero in .packet()
authorChunyan Zhang <zhang.chunyan@linaro.org>
Tue, 29 Nov 2016 16:47:11 +0000 (09:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Nov 2016 19:05:32 +0000 (20:05 +0100)
commit9870ef5c584e2ec7a5e9614e6b29fcc06d8bc139
tree01da2ab4820e849ba64cba8ec7ec04d8797d93aa
parent38d1790644ef781c2b883dea68c8f6ba4e60e2f2
coresight: stm: return error code instead of zero in .packet()

In STM framework driver, the trace data writing loop would keep running
until it received a negative return value or the whole trace packet has
been written to STM device.  So if the .packet() of STM device always
returns zero since the device is not enabled or the parameter isn't
supported, STM framework driver will stall into a dead loop.

Returning -EACCES (Permission denied) in .packet() if the device is
disabled makes more sense, and this is the same for returning -EINVAL
if the channel passed into is not supported.

Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/coresight/coresight-stm.c