Re: [PATCH] accel/qaic: Use devm_drm_dev_alloc() instead of drm_dev_alloc()

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

 



On Fri, Sep 01, 2023 at 10:12:36AM -0600, Jeffrey Hugo wrote:
> From: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@xxxxxxxxxxx>
> 
> Since drm_dev_alloc() is deprecated it is recommended to use
> devm_drm_dev_alloc() instead. Update the driver to start using
> devm_drm_dev_alloc().
> 
> Signed-off-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@xxxxxxxxxxx>
> Reviewed-by: Carl Vanderlip <quic_carlv@xxxxxxxxxxx>
> Reviewed-by: Jeffrey Hugo <quic_jhugo@xxxxxxxxxxx>
> Signed-off-by: Jeffrey Hugo <quic_jhugo@xxxxxxxxxxx>
> +	/*
> +	 * drm_dev_unregister() sets the driver data to NULL and
> +	 * drm_dev_register() does not update the driver data. During a SOC
> +	 * reset drm dev is unregistered and registered again leaving the
> +	 * driver data to NULL.
> +	 */
> +	dev_set_drvdata(to_accel_kdev(qddev), drm->accel);

Yeah, explicitly nullified in drm_minor_unregister() with ' /* safety belt */
comment. I think in long term goal would be device reset not require
unregister/register.

> +	drm_dev_get(drm);
> +	drm_dev_unregister(drm);

That looks odd. I guess there is use-after-free problem if you just do
drm_dev_unregister(). Additional drm_dev_get() does not seems to be right
solution, but I'm not 100% sure, so ... 

Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@xxxxxxxxxxxxxxx>

Regards
Stanislaw




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux