Re: [PATCH v3 02/22] drm: convert many bridge drivers from devm_kzalloc() to devm_drm_bridge_alloc() API

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

 



On Fri, May 09, 2025 at 03:53:28PM +0200, Luca Ceresoli wrote:
> devm_drm_bridge_alloc() is the new API to be used for allocating (and
> partially initializing) a private driver struct embedding a struct
> drm_bridge.
> 
> For many drivers having a simple code flow in the probe function, this
> commit does a mass conversion automatically with the following semantic
> patch. The changes have been reviewed manually for correctness as well as
> to find any false positives.
> 
> The patch has been applied with the explicit exclusion of bridge/panel.c,
> handled by a separate patch.
> 
> After applying the semantic patch, manually fixed these issues:
> 
>  - 4 drivers need ERR_CAST() instead of PTR_ERR() as the function calling
>    devm_drm_bridge_alloc() returns a pointer
>  - re-added empty lines and comments that the script had removed but that
>    should stay
> 
>   @@
>   type T;
>   identifier C;
>   identifier BR;
>   expression DEV;
>   expression FUNCS;
>   @@
>   -T *C;
>   +T *C;
>    ...
>   (
>   -C = devm_kzalloc(DEV, ...);
>   -if (!C)
>   -    return -ENOMEM;
>   +C = devm_drm_bridge_alloc(DEV, T, BR, FUNCS);
>   +if (IS_ERR(C))
>   +     return PTR_ERR(C);
>   |
>   -C = devm_kzalloc(DEV, ...);
>   -if (!C)
>   -    return ERR_PTR(-ENOMEM);
>   +C = devm_drm_bridge_alloc(DEV, T, BR, FUNCS);
>   +if (IS_ERR(C))
>   +     return PTR_ERR(C);
>   )
>    ...
>   -C->BR.funcs = FUNCS;
> 
> Reviewed-by: Manikandan Muralidharan <manikandan.m@xxxxxxxxxxxxx> # microchip-lvds.c
> Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx> # parade-ps8640
> Tested-by: Douglas Anderson <dianders@xxxxxxxxxxxx> # parade-ps8640
> Signed-off-by: Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>

Acked-by: Maxime Ripard <mripard@xxxxxxxxxx>

Maxime

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux