Commit 9870ef5c authored by Chunyan Zhang's avatar Chunyan Zhang Committed by Greg Kroah-Hartman

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: default avatarChunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 38d17906
...@@ -419,10 +419,10 @@ static ssize_t stm_generic_packet(struct stm_data *stm_data, ...@@ -419,10 +419,10 @@ static ssize_t stm_generic_packet(struct stm_data *stm_data,
struct stm_drvdata, stm); struct stm_drvdata, stm);
if (!(drvdata && local_read(&drvdata->mode))) if (!(drvdata && local_read(&drvdata->mode)))
return 0; return -EACCES;
if (channel >= drvdata->numsp) if (channel >= drvdata->numsp)
return 0; return -EINVAL;
ch_addr = (unsigned long)stm_channel_addr(drvdata, channel); ch_addr = (unsigned long)stm_channel_addr(drvdata, channel);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment