[bug report] drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel
Guido Günther
agx at sigxcpu.org
Fri Sep 4 07:47:02 UTC 2020
Hi,
On Mon, Aug 31, 2020 at 02:29:24PM +0300, Dan Carpenter wrote:
> Hello Guido Günther,
>
> The patch 72967d5616d3: "drm/panel: Add panel driver for the Mantix
> MLAF057WE51-X DSI panel" from Aug 17, 2020, leads to the following
> static checker warning:
>
> drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c:205 mantix_get_modes()
> error: we previously assumed 'mode' could be null (see line 204)
>
> drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
> 197 static int mantix_get_modes(struct drm_panel *panel,
> 198 struct drm_connector *connector)
> 199 {
> 200 struct mantix *ctx = panel_to_mantix(panel);
> 201 struct drm_display_mode *mode;
> 202
> 203 mode = drm_mode_duplicate(connector->dev, &default_mode);
> 204 if (!mode) {
> 205 dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n",
> 206 default_mode.hdisplay, default_mode.vdisplay,
> 207 drm_mode_vrefresh(mode));
> ^^^^
> This will lead to a NULL dereference.
Thanks, i'll fold a fix for this into some other upcoming changes to
this driver.
Cheers,
-- Guido
>
> 208 return -ENOMEM;
> 209 }
> 210
> 211 drm_mode_set_name(mode);
> 212
> 213 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> 214 connector->display_info.width_mm = mode->width_mm;
> 215 connector->display_info.height_mm = mode->height_mm;
> 216 drm_mode_probed_add(connector, mode);
> 217
> 218 return 1;
> 219 }
>
> regards,
> dan carpenter
>
More information about the dri-devel
mailing list