* [PATCH 1/2] [media] c8sectpfe: initialize err in load_slim_core_fw
@ 2015-09-20 14:14 Nicolas Iooss
2015-09-20 14:14 ` [PATCH 2/2] [media] c8sectpfe: forward err instead of returning an uninitialized variable Nicolas Iooss
0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Iooss @ 2015-09-20 14:14 UTC (permalink / raw)
To: Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard,
Mauro Carvalho Chehab, kernel
Cc: linux-media, linux-kernel, Nicolas Iooss
load_slim_core_fw() uses a for loop with !err in its condition without
first initializing err. Fix this by setting err to 0 in its definition.
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
index 486aef50d99b..a424339b18bc 100644
--- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
+++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
@@ -1097,7 +1097,7 @@ static int load_slim_core_fw(const struct firmware *fw, void *context)
Elf32_Ehdr *ehdr;
Elf32_Phdr *phdr;
u8 __iomem *dst;
- int err, i;
+ int err = 0, i;
if (!fw || !context)
return -EINVAL;
--
2.5.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] [media] c8sectpfe: forward err instead of returning an uninitialized variable
2015-09-20 14:14 [PATCH 1/2] [media] c8sectpfe: initialize err in load_slim_core_fw Nicolas Iooss
@ 2015-09-20 14:14 ` Nicolas Iooss
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Iooss @ 2015-09-20 14:14 UTC (permalink / raw)
To: Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard,
Mauro Carvalho Chehab, kernel
Cc: linux-media, linux-kernel, Nicolas Iooss
When load_c8sectpfe_fw_step1() tests whether the return value of
request_firmware_nowait(), stored in variable err, indicates an error,
it then returns the value hold by uninitialized variable ret, which
seems incorrect.
Fix this by forwarding the error returned by request_firmware_nowait()
to the caller of load_c8sectpfe_fw_step1().
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
index a424339b18bc..c25a1172bcf5 100644
--- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
+++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
@@ -1192,7 +1192,6 @@ err:
static int load_c8sectpfe_fw_step1(struct c8sectpfei *fei)
{
- int ret;
int err;
dev_info(fei->dev, "Loading firmware: %s\n", FIRMWARE_MEMDMA);
@@ -1207,7 +1206,7 @@ static int load_c8sectpfe_fw_step1(struct c8sectpfei *fei)
if (err) {
dev_err(fei->dev, "request_firmware_nowait err: %d.\n", err);
complete_all(&fei->fw_ack);
- return ret;
+ return err;
}
return 0;
--
2.5.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-20 14:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-20 14:14 [PATCH 1/2] [media] c8sectpfe: initialize err in load_slim_core_fw Nicolas Iooss
2015-09-20 14:14 ` [PATCH 2/2] [media] c8sectpfe: forward err instead of returning an uninitialized variable Nicolas Iooss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®