Skip to content

Commit

Permalink
media: camss: Use managed memory allocations
Browse files Browse the repository at this point in the history
Use managed memory allocations for structs which are used until
the driver is removed.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
  • Loading branch information
Todor Tomov authored and Mauro Carvalho Chehab committed Aug 29, 2018
1 parent 44a9ffd commit 55b5189
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions drivers/media/platform/qcom/camss/camss-ispif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,8 +1076,8 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
else
return -EINVAL;

ispif->line = kcalloc(ispif->line_num, sizeof(*ispif->line),
GFP_KERNEL);
ispif->line = devm_kcalloc(dev, ispif->line_num, sizeof(*ispif->line),
GFP_KERNEL);
if (!ispif->line)
return -ENOMEM;

Expand Down
11 changes: 6 additions & 5 deletions drivers/media/platform/qcom/camss/camss.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,17 +848,18 @@ static int camss_probe(struct platform_device *pdev)
return -EINVAL;
}

camss->csiphy = kcalloc(camss->csiphy_num, sizeof(*camss->csiphy),
GFP_KERNEL);
camss->csiphy = devm_kcalloc(dev, camss->csiphy_num,
sizeof(*camss->csiphy), GFP_KERNEL);
if (!camss->csiphy)
return -ENOMEM;

camss->csid = kcalloc(camss->csid_num, sizeof(*camss->csid),
GFP_KERNEL);
camss->csid = devm_kcalloc(dev, camss->csid_num, sizeof(*camss->csid),
GFP_KERNEL);
if (!camss->csid)
return -ENOMEM;

camss->vfe = kcalloc(camss->vfe_num, sizeof(*camss->vfe), GFP_KERNEL);
camss->vfe = devm_kcalloc(dev, camss->vfe_num, sizeof(*camss->vfe),
GFP_KERNEL);
if (!camss->vfe)
return -ENOMEM;

Expand Down

0 comments on commit 55b5189

Please sign in to comment.