Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105992
b: refs/heads/master
c: f37e661
h: refs/heads/master
v: v3
  • Loading branch information
Akinobu Mita authored and Linus Torvalds committed Jul 25, 2008
1 parent 640f5bb commit 7e325e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ec905a18656daa4d9300bad2bebc02d5dba7883d
refs/heads/master: f37e66173e0cc09b4e5a89eb0294abbefc15f435
12 changes: 3 additions & 9 deletions trunk/drivers/base/firmware_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,16 @@ firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr,
struct device *dev = to_dev(kobj);
struct firmware_priv *fw_priv = dev_get_drvdata(dev);
struct firmware *fw;
ssize_t ret_count = count;
ssize_t ret_count;

mutex_lock(&fw_lock);
fw = fw_priv->fw;
if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) {
ret_count = -ENODEV;
goto out;
}
if (offset > fw->size) {
ret_count = 0;
goto out;
}
if (offset + ret_count > fw->size)
ret_count = fw->size - offset;

memcpy(buffer, fw->data + offset, ret_count);
ret_count = memory_read_from_buffer(buffer, count, &offset,
fw->data, fw->size);
out:
mutex_unlock(&fw_lock);
return ret_count;
Expand Down

0 comments on commit 7e325e2

Please sign in to comment.