drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel
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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi,
Quoted 22 lines · Dan Carpenter
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(structdrm_panel*panel,
198 structdrm_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)); ^^^^
Quoted 1 line
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
Quoted 14 lines
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 }
Quoted 3 lines
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel