ssize_t ret = -EINVAL;
read_lock(&dev_base_lock);
- if (sdata->dev->reg_state == NETREG_REGISTERED) {
+ if (sdata->dev->reg_state == NETREG_REGISTERED)
ret = (*format)(sdata, buf, sizeof(buf));
- ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret);
- }
read_unlock(&dev_base_lock);
+
+ if (ret != -EINVAL)
+ ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret);
+
return ret;
}
memset(buf, 0x00, sizeof(buf));
buf_size = min(count, (sizeof(buf)-1));
- read_lock(&dev_base_lock);
if (copy_from_user(buf, userbuf, buf_size))
- goto endwrite;
+ return count;
+ read_lock(&dev_base_lock);
if (sdata->dev->reg_state == NETREG_REGISTERED)
(*format)(sdata, buf);
-endwrite:
read_unlock(&dev_base_lock);
+
return count;
}
#endif