firmware_class: Correct a null check in firmware_direct_read
Don't use the fw pointer before performing the null check on it. Change-Id: I303f71681647e2acb0b7e340b8f8580436cfb19d Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
This commit is contained in:
parent
2d65cf38d3
commit
9543a56f10
1 changed files with 4 additions and 1 deletions
|
@ -801,6 +801,9 @@ static ssize_t firmware_direct_read(struct file *filp, struct kobject *kobj,
|
||||||
struct firmware *fw;
|
struct firmware *fw;
|
||||||
ssize_t ret_count;
|
ssize_t ret_count;
|
||||||
|
|
||||||
|
if (!fw_priv->fw)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
mutex_lock(&fw_lock);
|
mutex_lock(&fw_lock);
|
||||||
fw = fw_priv->fw;
|
fw = fw_priv->fw;
|
||||||
|
|
||||||
|
@ -811,7 +814,7 @@ static ssize_t firmware_direct_read(struct file *filp, struct kobject *kobj,
|
||||||
if (count > fw->size - offset)
|
if (count > fw->size - offset)
|
||||||
count = fw->size - offset;
|
count = fw->size - offset;
|
||||||
|
|
||||||
if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->buf->status)) {
|
if (test_bit(FW_STATUS_DONE, &fw_priv->buf->status)) {
|
||||||
ret_count = -ENODEV;
|
ret_count = -ENODEV;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue