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:
Vikram Mulukutla 2014-08-07 17:36:23 -07:00 committed by Artem Borisov
parent c8cd2ed442
commit 4e2880ee5d

View file

@ -721,6 +721,9 @@ static ssize_t firmware_direct_read(struct file *filp, struct kobject *kobj,
struct firmware *fw;
ssize_t ret_count;
if (!fw_priv->fw)
return -ENODEV;
mutex_lock(&fw_lock);
fw = fw_priv->fw;
@ -731,7 +734,7 @@ static ssize_t firmware_direct_read(struct file *filp, struct kobject *kobj,
if (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;
goto out;
}