Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/msm/dcp: dcp_encoder_init() duplicates
  drmm_plain_encoder_alloc()
--

commit 670fd16befa378857922db7aa3647d8ae8930c7c
Author: Jayant Shekhar <[email protected]>

drm/msm/dcp: Add DCP encoder

This commit adds dcp_encoder_init() to allocate and initialize a DRM
encoder connecting a DCP CRTC to its output bridge.

> diff --git a/drivers/gpu/drm/msm/dcp/dcp_encoder.c 
> b/drivers/gpu/drm/msm/dcp/dcp_encoder.c
> new file mode 100644
> index 0000000000000..e7a64c960bdc9
> --- /dev/null
> +++ b/drivers/gpu/drm/msm/dcp/dcp_encoder.c
> @@ -0,0 +1,29 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> + *
> + * DCP encoder wrapper for the CRTC-to-bridge connection.
> + * Hardware programming and mode sequencing are handled by the bridge and 
> HFI.
> + */
> +
> +#include <drm/drm_encoder.h>
> +#include <drm/drm_managed.h>
> +
> +#include "dcp_encoder.h"
> +
> +struct drm_encoder *dcp_encoder_init(struct drm_device *dev, int enc_type)
> +{
> +     struct drm_encoder *encoder;
> +     int ret;
> +
> +     encoder = drmm_kzalloc(dev, sizeof(*encoder), GFP_KERNEL);
> +     if (!encoder)
> +             return ERR_PTR(-ENOMEM);
> +
> +     ret = drmm_encoder_init(dev, encoder, NULL, enc_type, "encoder%d",
> +                             dev->mode_config.num_encoder);
> +     if (ret)
> +             return ERR_PTR(ret);
> +
> +     return encoder;
> +}

[Severity: Low]
This isn't a bug, but dcp_encoder_init() open-codes
drmm_plain_encoder_alloc(), which already allocates and initializes a
non-subclassed struct drm_encoder in a single call.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=13

Reply via email to