* [bug report] drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel
@ 2020-08-31 11:29 Dan Carpenter
2020-09-04 7:47 ` Guido Günther
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-08-31 11:29 UTC (permalink / raw)
To: agx; +Cc: dri-devel
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.
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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [bug report] drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel
2020-08-31 11:29 [bug report] drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel Dan Carpenter
@ 2020-09-04 7:47 ` Guido Günther
0 siblings, 0 replies; 2+ messages in thread
From: Guido Günther @ 2020-09-04 7:47 UTC (permalink / raw)
To: Dan Carpenter; +Cc: dri-devel
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
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-04 7:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-31 11:29 [bug report] drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel Dan Carpenter
2020-09-04 7:47 ` Guido Günther
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.