Commit a4485bae authored by Bongsu Jeon's avatar Bongsu Jeon Committed by Jakub Kicinski

nfc: s3fwrn5: Release the nfc firmware

add the code to release the nfc firmware when the firmware image size is
wrong.

Fixes: c04c674f ("nfc: s3fwrn5: Add driver for Samsung S3FWRN5 NFC Chip")
Signed-off-by: default avatarBongsu Jeon <bongsu.jeon@samsung.com>
Reviewed-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20201213095850.28169-1-bongsu.jeon@samsung.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8163962a
......@@ -293,8 +293,10 @@ int s3fwrn5_fw_request_firmware(struct s3fwrn5_fw_info *fw_info)
if (ret < 0)
return ret;
if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE)
if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE) {
release_firmware(fw->fw);
return -EINVAL;
}
memcpy(fw->date, fw->fw->data + 0x00, 12);
fw->date[12] = '\0';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment