Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1532505

[PATCH 1/9] coresight: stm: return error code instead of zero in .packet()

From Mathieu Poirier <mathieu.poirier@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 1/9] coresight: stm: return error code instead of zero in .packet()
Date 2016-11-29 17:50 +0100
Message-ID <sITLs-2xM-51@gated-at.bofh.it> (permalink)
References <sITLr-2xM-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Chunyan Zhang <zhang.chunyan@linaro.org>

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 | 4 ++--
 1 file 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,
 						   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);
 
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/9] coresight: next v4.9-rc7  Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-11-29 17:50 +0100
  [PATCH 4/9] coresight: reset "enable_sink" flag when need be Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-11-29 17:50 +0100
  [PATCH 9/9] coresight: perf: Add a missing call to etm_free_aux Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-11-29 17:50 +0100
  [PATCH 5/9] coresight: tmc: Cleanup operation mode handling Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-11-29 17:50 +0100
  [PATCH 6/9] coresight: tmc: Get rid of mode parameter for helper routines Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-11-29 17:50 +0100
  [PATCH 2/9] coresight: etm3x: indentation fix (extra space removed) Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-11-29 17:50 +0100
  [PATCH 1/9] coresight: stm: return error code instead of zero in .packet() Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-11-29 17:50 +0100
  [PATCH 7/9] coresight: tmc: Remove duplicate memset Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-11-29 17:50 +0100
  [PATCH 8/9] coresight: Add support for ARM Coresight STM-500 Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-11-29 17:50 +0100
  [PATCH 3/9] coresight: etm3x: Adding missing features of Coresight PTM components Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-11-29 18:00 +0100
  Re: [PATCH 0/9] coresight: next v4.9-rc7 Greg KH <gregkh@linuxfoundation.org> - 2016-11-29 20:10 +0100

csiph-web