From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: patch@alsa-project.org, vinod.koul@linux.intel.com
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Subject: [PATCH - TINYCOMPRESS 4/4] compress: Do not put newlines on error messages
Date: Fri, 25 Jan 2013 10:43:14 +0000 [thread overview]
Message-ID: <1359110594-20163-4-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1359110594-20163-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>
In the oops function text is appended onto the end of the supplied error
message, so newlines appear in the middle of error messages. This patch
removes all newlines from supplied error messages.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
diff --git a/compress.c b/compress.c
index c575acd..19d618a 100644
--- a/compress.c
+++ b/compress.c
@@ -144,22 +144,22 @@ static bool _is_codec_supported(struct compress *compress, struct compr_config *
}
if (config->fragment_size < caps.min_fragment_size) {
- oops(compress, -EINVAL, "requested fragment size %d is below min supported %d\n",
+ oops(compress, -EINVAL, "requested fragment size %d is below min supported %d",
config->fragment_size, caps.min_fragment_size);
return false;
}
if (config->fragment_size > caps.max_fragment_size) {
- oops(compress, -EINVAL, "requested fragment size %d is above max supported %d\n",
+ oops(compress, -EINVAL, "requested fragment size %d is above max supported %d",
config->fragment_size, caps.max_fragment_size);
return false;
}
if (config->fragments < caps.min_fragments) {
- oops(compress, -EINVAL, "requested fragments %d are below min supported %d\n",
+ oops(compress, -EINVAL, "requested fragments %d are below min supported %d",
config->fragments, caps.min_fragments);
return false;
}
if (config->fragments > caps.max_fragments) {
- oops(compress, -EINVAL, "requested fragments %d are above max supported %d\n",
+ oops(compress, -EINVAL, "requested fragments %d are above max supported %d",
config->fragments, caps.max_fragments);
return false;
}
@@ -218,12 +218,12 @@ struct compress *compress_open(unsigned int card, unsigned int device,
compress->flags = flags;
if (!((flags & COMPRESS_OUT) || (flags & COMPRESS_IN))) {
- oops(&bad_compress, -EINVAL, "can't deduce device direction from given flags\n");
+ oops(&bad_compress, -EINVAL, "can't deduce device direction from given flags");
goto input_fail;
}
if (flags & COMPRESS_OUT) {
/* this should be removed once we have capture tested */
- oops(&bad_compress, -EINVAL, "this version doesnt support capture\n");
+ oops(&bad_compress, -EINVAL, "this version doesnt support capture");
goto input_fail;
}
@@ -237,7 +237,7 @@ struct compress *compress_open(unsigned int card, unsigned int device,
* and treat in no support case
*/
if (_is_codec_supported(compress, config) == false) {
- oops(&bad_compress, errno, "codec not supported\n");
+ oops(&bad_compress, errno, "codec not supported");
goto codec_fail;
}
#endif
@@ -335,7 +335,7 @@ int compress_write(struct compress *compress, char *buf, unsigned int size)
to_write = size;
written = write(compress->fd, buf, to_write);
if (written < 0)
- return oops(compress, errno, "write failed!\n");
+ return oops(compress, errno, "write failed!");
size -= written;
buf += written;
@@ -354,7 +354,7 @@ int compress_start(struct compress *compress)
if (!is_compress_ready(compress))
return oops(compress, -ENODEV, "device not ready");
if (ioctl(compress->fd, SNDRV_COMPRESS_START))
- return oops(compress, errno, "cannot start the stream\n");
+ return oops(compress, errno, "cannot start the stream");
compress->running = 1;
return 0;
@@ -365,7 +365,7 @@ int compress_stop(struct compress *compress)
if (!is_compress_running(compress))
return oops(compress, -ENODEV, "device not ready");
if (ioctl(compress->fd, SNDRV_COMPRESS_STOP))
- return oops(compress, errno, "cannot stop the stream\n");
+ return oops(compress, errno, "cannot stop the stream");
return 0;
}
@@ -374,14 +374,14 @@ int compress_pause(struct compress *compress)
if (!is_compress_running(compress))
return oops(compress, -ENODEV, "device not ready");
if (ioctl(compress->fd, SNDRV_COMPRESS_PAUSE))
- return oops(compress, errno, "cannot pause the stream\n");
+ return oops(compress, errno, "cannot pause the stream");
return 0;
}
int compress_resume(struct compress *compress)
{
if (ioctl(compress->fd, SNDRV_COMPRESS_RESUME))
- return oops(compress, errno, "cannot pause the stream\n");
+ return oops(compress, errno, "cannot pause the stream");
return 0;
}
@@ -390,7 +390,7 @@ int compress_drain(struct compress *compress)
if (!is_compress_running(compress))
return oops(compress, -ENODEV, "device not ready");
if (ioctl(compress->fd, SNDRV_COMPRESS_DRAIN))
- return oops(compress, errno, "cannot drain the stream\n");
+ return oops(compress, errno, "cannot drain the stream");
return 0;
}
--
1.7.2.5
next prev parent reply other threads:[~2013-01-25 10:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 10:43 [PATCH - TINYCOMPRESS 1/4] compress: Extend limit on error messages Charles Keepax
2013-01-25 10:43 ` [PATCH - TINYCOMPRESS 2/4] compress: Return error when failing to allocate compress struct Charles Keepax
2013-01-25 10:43 ` [PATCH - TINYCOMPRESS 3/4] compress: Return error messages correctly from compress_open Charles Keepax
2013-01-25 10:43 ` Charles Keepax [this message]
2013-01-28 6:13 ` [PATCH - TINYCOMPRESS 4/4] compress: Do not put newlines on error messages Vinod Koul
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=1359110594-20163-4-git-send-email-ckeepax@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=patch@alsa-project.org \
--cc=patches@opensource.wolfsonmicro.com \
--cc=vinod.koul@linux.intel.com \
/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;
as well as URLs for NNTP newsgroup(s).