mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-20 12:47:12 +07:00
media: vimc: keep the error value when adding an entity fails
Currently when the 'add' callback of an entity fails, a NULL is returned. This hides the error code of the failure and always returns -EINVAL. Replace return NULL with return ERR_PTR(ret) to improve debugging. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
7a040cf303
commit
967534cb49
@ -395,7 +395,7 @@ struct vimc_ent_device *vimc_cap_add(struct vimc_device *vimc,
|
|||||||
/* Allocate the vimc_cap_device struct */
|
/* Allocate the vimc_cap_device struct */
|
||||||
vcap = kzalloc(sizeof(*vcap), GFP_KERNEL);
|
vcap = kzalloc(sizeof(*vcap), GFP_KERNEL);
|
||||||
if (!vcap)
|
if (!vcap)
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
/* Initialize the media entity */
|
/* Initialize the media entity */
|
||||||
vcap->vdev.entity.name = vcfg_name;
|
vcap->vdev.entity.name = vcfg_name;
|
||||||
@ -476,5 +476,5 @@ struct vimc_ent_device *vimc_cap_add(struct vimc_device *vimc,
|
|||||||
err_free_vcap:
|
err_free_vcap:
|
||||||
kfree(vcap);
|
kfree(vcap);
|
||||||
|
|
||||||
return NULL;
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
@ -187,12 +187,15 @@ static int vimc_add_subdevs(struct vimc_device *vimc)
|
|||||||
vimc->pipe_cfg->ents[i].name);
|
vimc->pipe_cfg->ents[i].name);
|
||||||
vimc->ent_devs[i] = 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 (!vimc->ent_devs[i]) {
|
if (IS_ERR(vimc->ent_devs[i])) {
|
||||||
dev_err(vimc->mdev.dev, "add new entity for %s\n",
|
int err = PTR_ERR(vimc->ent_devs[i]);
|
||||||
vimc->pipe_cfg->ents[i].name);
|
|
||||||
|
dev_err(vimc->mdev.dev, "adding entity %s failed (%d)\n",
|
||||||
|
vimc->pipe_cfg->ents[i].name, err);
|
||||||
|
vimc->ent_devs[i] = NULL;
|
||||||
vimc_unregister_subdevs(vimc);
|
vimc_unregister_subdevs(vimc);
|
||||||
vimc_release_subdevs(vimc);
|
vimc_release_subdevs(vimc);
|
||||||
return -EINVAL;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -532,7 +532,7 @@ struct vimc_ent_device *vimc_deb_add(struct vimc_device *vimc,
|
|||||||
/* Allocate the vdeb struct */
|
/* Allocate the vdeb struct */
|
||||||
vdeb = kzalloc(sizeof(*vdeb), GFP_KERNEL);
|
vdeb = kzalloc(sizeof(*vdeb), GFP_KERNEL);
|
||||||
if (!vdeb)
|
if (!vdeb)
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
/* Create controls: */
|
/* Create controls: */
|
||||||
v4l2_ctrl_handler_init(&vdeb->hdl, 2);
|
v4l2_ctrl_handler_init(&vdeb->hdl, 2);
|
||||||
@ -577,5 +577,5 @@ struct vimc_ent_device *vimc_deb_add(struct vimc_device *vimc,
|
|||||||
err_free_vdeb:
|
err_free_vdeb:
|
||||||
kfree(vdeb);
|
kfree(vdeb);
|
||||||
|
|
||||||
return NULL;
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
@ -483,7 +483,7 @@ struct vimc_ent_device *vimc_sca_add(struct vimc_device *vimc,
|
|||||||
/* Allocate the vsca struct */
|
/* Allocate the vsca struct */
|
||||||
vsca = kzalloc(sizeof(*vsca), GFP_KERNEL);
|
vsca = kzalloc(sizeof(*vsca), GFP_KERNEL);
|
||||||
if (!vsca)
|
if (!vsca)
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
/* Initialize ved and sd */
|
/* Initialize ved and sd */
|
||||||
vsca->pads[0].flags = MEDIA_PAD_FL_SINK;
|
vsca->pads[0].flags = MEDIA_PAD_FL_SINK;
|
||||||
@ -495,7 +495,7 @@ struct vimc_ent_device *vimc_sca_add(struct vimc_device *vimc,
|
|||||||
vsca->pads, &vimc_sca_ops);
|
vsca->pads, &vimc_sca_ops);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
kfree(vsca);
|
kfree(vsca);
|
||||||
return NULL;
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
vsca->ved.process_frame = vimc_sca_process_frame;
|
vsca->ved.process_frame = vimc_sca_process_frame;
|
||||||
|
@ -317,7 +317,7 @@ struct vimc_ent_device *vimc_sen_add(struct vimc_device *vimc,
|
|||||||
/* Allocate the vsen struct */
|
/* Allocate the vsen struct */
|
||||||
vsen = kzalloc(sizeof(*vsen), GFP_KERNEL);
|
vsen = kzalloc(sizeof(*vsen), GFP_KERNEL);
|
||||||
if (!vsen)
|
if (!vsen)
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
v4l2_ctrl_handler_init(&vsen->hdl, 4);
|
v4l2_ctrl_handler_init(&vsen->hdl, 4);
|
||||||
|
|
||||||
@ -372,5 +372,5 @@ struct vimc_ent_device *vimc_sen_add(struct vimc_device *vimc,
|
|||||||
err_free_vsen:
|
err_free_vsen:
|
||||||
kfree(vsen);
|
kfree(vsen);
|
||||||
|
|
||||||
return NULL;
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user