The cdns-mhdp8546 bridge atomic_reset implementation is semantically
an atomic_create_state: it allocates and initializes a pristine state
without side effects.

However, it returns NULL on allocation failure instead of an error
pointer.

Switch to the atomic_create_state callback, rename the function
accordingly, and return ERR_PTR(-ENOMEM) on failure.

Signed-off-by: Maxime Ripard <[email protected]>
---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c 
b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
index 063f073034c1..504a3186ebb3 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
@@ -1919,17 +1919,17 @@ cdns_mhdp_bridge_atomic_destroy_state(struct drm_bridge 
*bridge,
 
        kfree(cdns_mhdp_state);
 }
 
 static struct drm_bridge_state *
-cdns_mhdp_bridge_atomic_reset(struct drm_bridge *bridge)
+cdns_mhdp_bridge_atomic_create_state(struct drm_bridge *bridge)
 {
        struct cdns_mhdp_bridge_state *cdns_mhdp_state;
 
        cdns_mhdp_state = kzalloc_obj(*cdns_mhdp_state);
        if (!cdns_mhdp_state)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
        __drm_atomic_helper_bridge_state_init(&cdns_mhdp_state->base, bridge);
 
        return &cdns_mhdp_state->base;
 }
@@ -2049,11 +2049,11 @@ static const struct drm_bridge_funcs 
cdns_mhdp_bridge_funcs = {
        .atomic_check = cdns_mhdp_atomic_check,
        .attach = cdns_mhdp_attach,
        .detach = cdns_mhdp_detach,
        .atomic_duplicate_state = cdns_mhdp_bridge_atomic_duplicate_state,
        .atomic_destroy_state = cdns_mhdp_bridge_atomic_destroy_state,
-       .atomic_reset = cdns_mhdp_bridge_atomic_reset,
+       .atomic_create_state = cdns_mhdp_bridge_atomic_create_state,
        .atomic_get_input_bus_fmts = cdns_mhdp_get_input_bus_fmts,
        .detect = cdns_mhdp_bridge_detect,
        .edid_read = cdns_mhdp_bridge_edid_read,
        .hpd_enable = cdns_mhdp_bridge_hpd_enable,
        .hpd_disable = cdns_mhdp_bridge_hpd_disable,

-- 
2.54.0

Reply via email to