Message ID | 20191003104409.15756-2-dafna.hirschfeld@collabora.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: vimc: bug fixes related to memory management | expand |
On 10/3/19 7:44 AM, Dafna Hirschfeld wrote: > since NULL value for vimc entity pointer indicates > that entity creation failed and this is tested, the > pointers should be initialized to NULL. > > Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Acked-by: Helen Koike <helen.koike@collabora.com> > --- > drivers/media/platform/vimc/vimc-core.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c > index 6e3e5c91ae39..b8add4087652 100644 > --- a/drivers/media/platform/vimc/vimc-core.c > +++ b/drivers/media/platform/vimc/vimc-core.c > @@ -199,9 +199,8 @@ static int vimc_register_devices(struct vimc_device *vimc) > } > > /* allocate ent_devs */ > - vimc->ent_devs = kmalloc_array(vimc->pipe_cfg->num_ents, > - sizeof(*vimc->ent_devs), > - GFP_KERNEL); > + vimc->ent_devs = kcalloc(vimc->pipe_cfg->num_ents, > + sizeof(*vimc->ent_devs), GFP_KERNEL); > if (!vimc->ent_devs) > goto err_v4l2_unregister; > >
diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c index 6e3e5c91ae39..b8add4087652 100644 --- a/drivers/media/platform/vimc/vimc-core.c +++ b/drivers/media/platform/vimc/vimc-core.c @@ -199,9 +199,8 @@ static int vimc_register_devices(struct vimc_device *vimc) } /* allocate ent_devs */ - vimc->ent_devs = kmalloc_array(vimc->pipe_cfg->num_ents, - sizeof(*vimc->ent_devs), - GFP_KERNEL); + vimc->ent_devs = kcalloc(vimc->pipe_cfg->num_ents, + sizeof(*vimc->ent_devs), GFP_KERNEL); if (!vimc->ent_devs) goto err_v4l2_unregister;
since NULL value for vimc entity pointer indicates that entity creation failed and this is tested, the pointers should be initialized to NULL. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> --- drivers/media/platform/vimc/vimc-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)