On Tue, Jun 02, 2015 at 03:35:56PM -0500, Aravind Gopalakrishnan wrote:
+Didn't your compiler trigger that:
+ buf[cnt - 1] = 0;
+
+ /* strip whitespaces.. */
+ strstrip(buf);
drivers/edac/mce_amd_inj.c: In function âflags_writeâ:
drivers/edac/mce_amd_inj.c:146:2: warning: ignoring return value of âstrstripâ, declared with attribute warn_unused_result [-Wunused-result]
strstrip(buf);
^
?
Because it is a valid warning. You need to take the return value. I
fixed it up like this:
---
diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c
index c129a8da34b2..5c847fe6e9bd 100644
--- a/drivers/edac/mce_amd_inj.c
+++ b/drivers/edac/mce_amd_inj.c
@@ -128,7 +128,7 @@ static ssize_t flags_read(struct file *filp, char __user *ubuf,
static ssize_t flags_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
- char buf[MAX_FLAG_OPT_SIZE];
+ char buf[MAX_FLAG_OPT_SIZE], *__buf;
int err;
size_t ret;
@@ -142,12 +142,12 @@ static ssize_t flags_write(struct file *filp, const char __user *ubuf,
buf[cnt - 1] = 0;
- /* strip whitespaces.. */
- strstrip(buf);
+ /* strip whitespace */
+ __buf = strstrip(buf);
- err = __set_inj(buf);
+ err = __set_inj(__buf);
if (err) {
- pr_err("%s: Invalid flags value: %s\n", __func__, buf);
+ pr_err("%s: Invalid flags value: %s\n", __func__, __buf);
return err;
}