Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox...
[linux-2.6-microblaze.git] / drivers / net / wireless / realtek / rtlwifi / debug.c
index 901cdfe..0b1bc04 100644 (file)
@@ -329,8 +329,8 @@ static ssize_t rtl_debugfs_set_write_h2c(struct file *filp,
 
        tmp_len = (count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count);
 
-       if (!buffer || copy_from_user(tmp, buffer, tmp_len))
-               return count;
+       if (copy_from_user(tmp, buffer, tmp_len))
+               return -EFAULT;
 
        tmp[tmp_len] = '\0';
 
@@ -340,8 +340,8 @@ static ssize_t rtl_debugfs_set_write_h2c(struct file *filp,
                         &h2c_data[4], &h2c_data[5],
                         &h2c_data[6], &h2c_data[7]);
 
-       if (h2c_len <= 0)
-               return count;
+       if (h2c_len == 0)
+               return -EINVAL;
 
        for (i = 0; i < h2c_len; i++)
                h2c_data_packed[i] = (u8)h2c_data[i];