coresight: stm: return error code instead of zero in .packet()
authorChunyan Zhang <zhang.chunyan@linaro.org>
Fri, 9 Sep 2016 10:18:09 +0000 (18:18 +0800)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Fri, 9 Sep 2016 15:34:12 +0000 (09:34 -0600)
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>
drivers/hwtracing/coresight/coresight-stm.c

index 49e0f1b925a5a656e228e9cb58c74c74997eb907..d397849c2c6ad0f7d79c878b48dcd67fc5af742c 100644 (file)
@@ -419,10 +419,10 @@ static ssize_t stm_generic_packet(struct stm_data *stm_data,
                                                   struct stm_drvdata, stm);
 
        if (!(drvdata && local_read(&drvdata->mode)))
-               return 0;
+               return -EACCES;
 
        if (channel >= drvdata->numsp)
-               return 0;
+               return -EINVAL;
 
        ch_addr = (unsigned long)stm_channel_addr(drvdata, channel);
 
This page took 0.026499 seconds and 5 git commands to generate.