Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9543a56f authored by Vikram Mulukutla's avatar Vikram Mulukutla Committed by David Keitel
Browse files

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: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent 2d65cf38
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -801,6 +801,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;

@@ -811,7 +814,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;
	}