From: mathieu.poirier@linaro.org (Mathieu Poirier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/9] coresight: stm: return error code instead of zero in .packet()
Date: Tue, 29 Nov 2016 09:47:11 -0700 [thread overview]
Message-ID: <1480438039-24960-2-git-send-email-mathieu.poirier@linaro.org> (raw)
In-Reply-To: <1480438039-24960-1-git-send-email-mathieu.poirier@linaro.org>
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
next prev parent reply other threads:[~2016-11-29 16:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 16:47 [PATCH 0/9] coresight: next v4.9-rc7 Mathieu Poirier
2016-11-29 16:47 ` Mathieu Poirier [this message]
2016-11-29 16:47 ` [PATCH 2/9] coresight: etm3x: indentation fix (extra space removed) Mathieu Poirier
2016-11-29 16:47 ` [PATCH 3/9] coresight: etm3x: Adding missing features of Coresight PTM components Mathieu Poirier
2016-11-29 16:47 ` [PATCH 4/9] coresight: reset "enable_sink" flag when need be Mathieu Poirier
2016-11-29 16:47 ` [PATCH 5/9] coresight: tmc: Cleanup operation mode handling Mathieu Poirier
2016-11-29 16:47 ` [PATCH 6/9] coresight: tmc: Get rid of mode parameter for helper routines Mathieu Poirier
2016-11-29 16:47 ` [PATCH 7/9] coresight: tmc: Remove duplicate memset Mathieu Poirier
2016-11-29 16:47 ` [PATCH 8/9] coresight: Add support for ARM Coresight STM-500 Mathieu Poirier
2016-11-29 16:47 ` [PATCH 9/9] coresight: perf: Add a missing call to etm_free_aux Mathieu Poirier
2016-11-29 19:06 ` [PATCH 0/9] coresight: next v4.9-rc7 Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480438039-24960-2-git-send-email-mathieu.poirier@linaro.org \
--to=mathieu.poirier@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox