Re: [PATCH 2/6] V4L2: mx3_camera: convert to managed resource allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guennadi ,

On 8 August 2013 20:22, Guennadi Liakhovetski <g.liakhovetski@xxxxxx> wrote:
> Use devm_* resource allocators to simplify the driver's probe and clean up
> paths.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>
> ---
>  drivers/media/platform/soc_camera/mx3_camera.c |   47 +++++-------------------
>  1 files changed, 10 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c
> index 1047e3e..e526096 100644
> --- a/drivers/media/platform/soc_camera/mx3_camera.c
> +++ b/drivers/media/platform/soc_camera/mx3_camera.c
> @@ -1151,23 +1151,19 @@ static int mx3_camera_probe(struct platform_device *pdev)
>         struct soc_camera_host *soc_host;
>
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       if (!res) {
> -               err = -ENODEV;
> -               goto egetres;
> -       }
> +       base = devm_ioremap_resource(&pdev->dev, res);
> +       if (IS_ERR(base))
> +               return PTR_ERR(base);
>
> -       mx3_cam = vzalloc(sizeof(*mx3_cam));
> +       mx3_cam = devm_kzalloc(&pdev->dev, sizeof(*mx3_cam), GFP_KERNEL);
>         if (!mx3_cam) {
>                 dev_err(&pdev->dev, "Could not allocate mx3 camera object\n");

This print is also redundant as kzalloc prints error on failure.


-- 
With warm regards,
Sachin
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux