Skip to contentSkip to conversation

drm/i915: Copy the staged connector config to the legacy atomic state

PATCH Applied Dan Carpenter 5 participants 5 messages Mar 27, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Ander Conselvan de Oliveira,

The patch 944b0c765757: "drm/i915: Copy the staged connector config to the legacy atomic state" from Mar 20, 2015, leads to the following Smatch warning:

	drivers/gpu/drm/i915/intel_display.c:11937 intel_modeset_stage_output_state()
	error: 'connector_state' dereferencing possible ERR_PTR()

drivers/gpu/drm/i915/intel_display.c
11928 /* Now we've also updated encoder->new_crtc for all encoders. */
11929 for_each_intel_connector(dev, connector) {
11930 connector_state =

 11931                          drm_atomic_get_connector_state(state, &connector->base);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It's complaining that this can return an ERR_PTR.

11932
11933 if (connector->new_encoder) {
11934 if (connector->new_encoder != connector->encoder)
11935 connector->encoder = connector->new_encoder;
11936 } else {
11937 connector_state->crtc = NULL;
11938 }
11939 }

regards,
dan carpenter
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#1 lore raw

PATCH 1/1 drm/i915: Handle error to get connector state when staging config

The return value of one of the calls to drm_atomic_get_connector_state() in intel_modeset_stage_output_state() wasn't checked for errors.

---
 drivers/gpu/drm/i915/intel_display.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_display.c +2 -0
index 68fe8b8..1329ed2 100644
@@ -12000,6 +12000,8 @@ intel_modeset_stage_output_state(struct drm_device *dev,
 	for_each_intel_connector(dev, connector) {
 		connector_state =
 			drm_atomic_get_connector_state(state, &connector->base);
+		if (IS_ERR(connector_state))
+			return PTR_ERR(connector_state);
 
 		if (connector->new_encoder) {
 			if (connector->new_encoder != connector->encoder)
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
In reply to Dan Carpenter
Quoted 9 lines · Dan Carpenter

Hello Ander Conselvan de Oliveira,

The patch 944b0c765757: "drm/i915: Copy the staged connector config to the legacy atomic state" from Mar 20, 2015, leads to the following Smatch warning:

	drivers/gpu/drm/i915/intel_display.c:11937 intel_modeset_stage_output_state()
	error: 'connector_state' dereferencing possible ERR_PTR()
Quoted 7 lines

drivers/gpu/drm/i915/intel_display.c
11928 /* Now we've also updated encoder->new_crtc for all encoders. */
11929 for_each_intel_connector(dev, connector) {
11930 connector_state =

 11931                          drm_atomic_get_connector_state(state, &connector->base);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It's complaining that this can return an ERR_PTR.

Yeah, oops, I missed that one. Thanks for reporting.

Cheers,
Ander

Quoted 10 lines

11932
11933 if (connector->new_encoder) {
11934 if (connector->new_encoder != connector->encoder)
11935 connector->encoder = connector->new_encoder;
11936 } else {
11937 connector_state->crtc = NULL;
11938 }
11939 }

Quoted 2 lines

regards,
dan carpenter

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

Re: [PATCH] drm/i915: Handle error to get connector state when staging config

In reply to Ander Conselvan de Oliveira
Quoted 5 lines · Ander Conselvan de Oliveira

The return value of one of the calls to drm_atomic_get_connector_state() in intel_modeset_stage_output_state() wasn't checked for errors.

Queued for -next, thanks for the patch.
-Daniel

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_display.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_display.c +2 -0
index 68fe8b8..1329ed2 100644
@@ -12000,6 +12000,8 @@ intel_modeset_stage_output_state(struct drm_device *dev,
 	for_each_intel_connector(dev, connector) {
 		connector_state =
 			drm_atomic_get_connector_state(state, &connector->base);
+		if (IS_ERR(connector_state))
+			return PTR_ERR(connector_state);
 
 		if (connector->new_encoder) {
 			if (connector->new_encoder != connector->encoder)
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#3 lore raw

Re: [PATCH] drm/i915: Handle error to get connector state when staging config

In reply to Ander Conselvan de Oliveira

Task id: 6081 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

PNV                                  276/276              276/276
ILK                                  303/303              303/303
SNB                                  304/304              304/304
IVB                 -1              330/330              329/330
BYT                                  287/287              287/287
HSW                                  361/361              361/361
BDW                                  309/309              309/309

-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*IVB igt@gem_pwrite_pread@snooped-copy-performance PASS(5) DMESG_WARN(1)PASS(1)
(dmesg patch applied)drm:i915_hangcheck_elapsed[i915]]*ERROR*Hangcheck_timer_elapsed...blitter_ring_idle@Hangcheck timer elapsed... blitter ring idle
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx