aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChunyan Zhang <zhang.chunyan@linaro.org>2016-11-29 11:47:11 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-29 14:05:32 -0500
commit9870ef5c584e2ec7a5e9614e6b29fcc06d8bc139 (patch)
tree01da2ab4820e849ba64cba8ec7ec04d8797d93aa
parent38d1790644ef781c2b883dea68c8f6ba4e60e2f2 (diff)
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>
-rw-r--r--drivers/hwtracing/coresight/coresight-stm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
index 49e0f1b925a5..d397849c2c6a 100644
--- a/drivers/hwtracing/coresight/coresight-stm.c
+++ b/drivers/hwtracing/coresight/coresight-stm.c
@@ -419,10 +419,10 @@ static ssize_t stm_generic_packet(struct stm_data *stm_data,
419 struct stm_drvdata, stm); 419 struct stm_drvdata, stm);
420 420
421 if (!(drvdata && local_read(&drvdata->mode))) 421 if (!(drvdata && local_read(&drvdata->mode)))
422 return 0; 422 return -EACCES;
423 423
424 if (channel >= drvdata->numsp) 424 if (channel >= drvdata->numsp)
425 return 0; 425 return -EINVAL;
426 426
427 ch_addr = (unsigned long)stm_channel_addr(drvdata, channel); 427 ch_addr = (unsigned long)stm_channel_addr(drvdata, channel);
428 428