Commit 4996992c authored by Dafna Hirschfeld's avatar Dafna Hirschfeld Committed by Mauro Carvalho Chehab

media: vimc: cleanup code that assigns entity in entities array

Since the add callback returns NULL on failure and the array
is initialized to NULLs, there is no need for the intermediate
assignment to local var.
Signed-off-by: default avatarDafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: default avatarHelen Koike <helen.koike@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 817d0b32
...@@ -160,19 +160,17 @@ static int vimc_create_links(struct vimc_device *vimc) ...@@ -160,19 +160,17 @@ static int vimc_create_links(struct vimc_device *vimc)
static int vimc_add_subdevs(struct vimc_device *vimc) static int vimc_add_subdevs(struct vimc_device *vimc)
{ {
unsigned int i; unsigned int i;
struct vimc_ent_device *ved;
for (i = 0; i < vimc->pipe_cfg->num_ents; i++) { for (i = 0; i < vimc->pipe_cfg->num_ents; i++) {
dev_dbg(&vimc->pdev.dev, "new entity for %s\n", dev_dbg(&vimc->pdev.dev, "new entity for %s\n",
vimc->pipe_cfg->ents[i].name); vimc->pipe_cfg->ents[i].name);
ved = vimc->pipe_cfg->ents[i].add(vimc, vimc->ent_devs[i] = vimc->pipe_cfg->ents[i].add(vimc,
vimc->pipe_cfg->ents[i].name); vimc->pipe_cfg->ents[i].name);
if (!ved) { if (!vimc->ent_devs[i]) {
dev_err(&vimc->pdev.dev, "add new entity for %s\n", dev_err(&vimc->pdev.dev, "add new entity for %s\n",
vimc->pipe_cfg->ents[i].name); vimc->pipe_cfg->ents[i].name);
return -EINVAL; return -EINVAL;
} }
vimc->ent_devs[i] = ved;
} }
return 0; return 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