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

Commit 9909a6b8 authored by Raghavendra Rao Ananta's avatar Raghavendra Rao Ananta Committed by Gaurav Kohli
Browse files

soc: qcom: pil: Avoid memory leaks by releasing the firmware resources



Currently, the driver calls request_firmware_into_buf() to load
the firmware image onto a pre-allocated memory. During the
process, some firmware resources are created. Usually, it
should be freed by a call to release_firmware() once the
firmware is loaded. However, the driver doesn't do this.
Hence, the memory is leaked each time a subsystem powerup
handling path is triggered (from a restart or a crash handling).
Therefore, release the firmware resources once the firmware is
loaded onto the memory.

Change-Id: I565afeda1157c9f7952336462ae0b022a2eca0bd
Signed-off-by: default avatarRaghavendra Rao Ananta <rananta@codeaurora.org>
Signed-off-by: default avatarGaurav Kohli <gkohli@codeaurora.org>
parent 5326a970
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -849,8 +849,11 @@ static int pil_load_seg(struct pil_desc *desc, struct pil_seg *seg)
		if (fw->size != seg->filesz) {
			pil_err(desc, "Blob size %u doesn't match %lu\n",
					ret, seg->filesz);
			release_firmware(fw);
			return -EPERM;
		}

		release_firmware(fw);
	}

	/* Zero out trailing memory */