Hi Thomas, The link to the new PR is here.
https://lore.kernel.org/all/[email protected]/ > diff --git a/drivers/gpu/drm/yhgch/yhgch_drm_vdac.c > b/drivers/gpu/drm/yhgch/yhgch_drm_vdac.c > new file mode 100644 > index 000000000000..2de95c887b62 > --- /dev/null > +++ b/drivers/gpu/drm/yhgch/yhgch_drm_vdac.c > @@ -0,0 +1,137 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +#include <linux/io.h> > + > +#include <drm/drm_atomic_helper.h> > +#include <drm/drm_edid.h> > +#include <drm/drm_probe_helper.h> > +#include <drm/drm_print.h> > +#include <drm/drm_simple_kms_helper.h> > + > +#include "yhgch_drm_drv.h" > +#include "yhgch_drm_regs.h" > + > +static int yhgch_connector_get_modes(struct drm_connector *connector) > +{ > + int count; > + const struct drm_edid *drm_edid; > + > + drm_edid = drm_edid_read(connector); > + if (drm_edid) { > + drm_edid_connector_update(connector, drm_edid); > + count = drm_edid_connector_add_modes(connector); > + drm_edid_free(drm_edid); > + if (count) > + goto out; Don't do the goto here. Simple call drm_edid_free(). > + } else { > + drm_edid_connector_update(connector, NULL); > + } > + > + count = drm_add_modes_noedid(connector, > + connector->dev->mode_config.max_width, > + connector->dev->mode_config.max_height); > + drm_set_preferred_mode(connector, 1024, 768); These two calls belong into the else branch. If you have an EDID, please don't try to make up your own defaults. Answer: This is to avoid encountering the situation where the display cannot be read (some special displays do not have EDID). > + > +out: > + drm_edid_free(drm_edid); This only belongs into the if branch. You also have a double free on drm_edid in that case. I wonder how you did not notice. Answer: Revisions have been made in accordance with your requirements. We apologize for not noticing the double free issue and thank you for pointing it out. > + return count; Returning 0 here is not a problem. DRM will try several steps to figure out the display modes, and eventually fallback to defaults. Best regards Chu Guangqing
