Commit a1b01987 authored by Bjorn Andersson's avatar Bjorn Andersson
Browse files

soc: qcom: mdt_loader: Fix split-firmware condition



The updated condition checking if a segment can be found in the loaded
firmware blob, or need to be loaded from a separate file, incorrectly
classifies segments that ends at the end of the loaded blob. The result
is that the mdt loader attempts to load the segment from a separate
file.

Correct the conditional to use the loaded segment instead.

Fixes: ea90330f ("soc: qcom: mdt_loader: Extend check for split firmware")
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: default avatarVinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20220215034819.1209367-1-bjorn.andersson@linaro.org
parent c9413e3e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
		ptr = mem_region + offset;

		if (phdr->p_filesz && phdr->p_offset < fw->size &&
		    phdr->p_offset + phdr->p_filesz < fw->size) {
		    phdr->p_offset + phdr->p_filesz <= fw->size) {
			/* Firmware is large enough to be non-split */
			if (phdr->p_offset + phdr->p_filesz > fw->size) {
				dev_err(dev, "file %s segment %d would be truncated\n",