diff options
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/dcdbas.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c index 0b624e927a6f..c66817e7717b 100644 --- a/drivers/firmware/dcdbas.c +++ b/drivers/firmware/dcdbas.c | |||
@@ -152,20 +152,11 @@ static ssize_t smi_data_read(struct kobject *kobj, | |||
152 | struct bin_attribute *bin_attr, | 152 | struct bin_attribute *bin_attr, |
153 | char *buf, loff_t pos, size_t count) | 153 | char *buf, loff_t pos, size_t count) |
154 | { | 154 | { |
155 | size_t max_read; | ||
156 | ssize_t ret; | 155 | ssize_t ret; |
157 | 156 | ||
158 | mutex_lock(&smi_data_lock); | 157 | mutex_lock(&smi_data_lock); |
159 | 158 | ret = memory_read_from_buffer(buf, count, &pos, smi_data_buf, | |
160 | if (pos >= smi_data_buf_size) { | 159 | smi_data_buf_size); |
161 | ret = 0; | ||
162 | goto out; | ||
163 | } | ||
164 | |||
165 | max_read = smi_data_buf_size - pos; | ||
166 | ret = min(max_read, count); | ||
167 | memcpy(buf, smi_data_buf + pos, ret); | ||
168 | out: | ||
169 | mutex_unlock(&smi_data_lock); | 160 | mutex_unlock(&smi_data_lock); |
170 | return ret; | 161 | return ret; |
171 | } | 162 | } |