Skip to content

Commit ad68c62

Browse files
Alex Elderandersson
authored andcommitted
soc: qcom: mdt_loader: be more informative on errors
In __qcom_mdt_load() there are cases where an error occurs that cause a message to be printed. In some of those cases the errno value can be helpful to understand exactly what caused the problem. Print the errno (as well as the firmware file name) where it is helpful, and in a few cases reword the error message. Consistently use the private fw_name for the file name. Signed-off-by: Alex Elder <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent a95fc72 commit ad68c62

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

drivers/soc/qcom/mdt_loader.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,18 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
166166
metadata = qcom_mdt_read_metadata(fw, &metadata_len);
167167
if (IS_ERR(metadata)) {
168168
ret = PTR_ERR(metadata);
169+
dev_err(dev, "error %d reading firmware %s metadata\n",
170+
ret, fw_name);
169171
goto out;
170172
}
171173

172174
ret = qcom_scm_pas_init_image(pas_id, metadata, metadata_len);
173175

174176
kfree(metadata);
175177
if (ret) {
176-
dev_err(dev, "invalid firmware metadata\n");
178+
/* Invalid firmware metadata */
179+
dev_err(dev, "error %d initializing firmware %s\n",
180+
ret, fw_name);
177181
goto out;
178182
}
179183
}
@@ -199,7 +203,9 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
199203
ret = qcom_scm_pas_mem_setup(pas_id, mem_phys,
200204
max_addr - min_addr);
201205
if (ret) {
202-
dev_err(dev, "unable to setup relocation\n");
206+
/* Unable to set up relocation */
207+
dev_err(dev, "error %d setting up firmware %s\n",
208+
ret, fw_name);
203209
goto out;
204210
}
205211
}
@@ -243,9 +249,8 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
243249
if (phdr->p_filesz && phdr->p_offset < fw->size) {
244250
/* Firmware is large enough to be non-split */
245251
if (phdr->p_offset + phdr->p_filesz > fw->size) {
246-
dev_err(dev,
247-
"failed to load segment %d from truncated file %s\n",
248-
i, firmware);
252+
dev_err(dev, "file %s segment %d would be truncated\n",
253+
fw_name, i);
249254
ret = -EINVAL;
250255
break;
251256
}
@@ -257,7 +262,8 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
257262
ret = request_firmware_into_buf(&seg_fw, fw_name, dev,
258263
ptr, phdr->p_filesz);
259264
if (ret) {
260-
dev_err(dev, "failed to load %s\n", fw_name);
265+
dev_err(dev, "error %d loading %s\n",
266+
ret, fw_name);
261267
break;
262268
}
263269

0 commit comments

Comments
 (0)