Skip to contentSkip to conversation

drm/ast: Zero is missing in detect function

PATCH In review [email protected] 2 participants 4 messages Jul 16, 2021 – Jul 20, 2021

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

PATCH 1/1 drm/ast: Zero is missing in detect function

From: "Ainux.Wang" <[email protected]>

The function ast_get_modes() will also return 0, when it try to get the edid, but it also do not get the edid.

---
 drivers/gpu/drm/ast/ast_mode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ast/ast_mode.c +1 -1
index e5996ae03c49..b7dcf7821ec6 100644
@@ -1299,7 +1299,7 @@ static enum drm_connector_status ast_connector_detect(struct drm_connector
 	int r;
 
 	r = ast_get_modes(connector);
-	if (r < 0)
+	if (r <= 0)
 		return connector_status_disconnected;
 
 	return connector_status_connected;
Signature · 1 line
2.18.1
#1 lore raw

Hi

Am 16.07.21 um 03:56 schrieb [email protected]:

Quoted 15 lines

From: "Ainux.Wang" <[email protected]>

The function ast_get_modes() will also return 0, when it try to get the edid, but it also do not get the edid.

---
  drivers/gpu/drm/ast/ast_mode.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ast/ast_mode.c +0 -0
index e5996ae03c49..b7dcf7821ec6 100644

drivers/gpu/drm/ast/ast_mode.c static enum drm_connector_status ast_connector_detect(struct drm_connector · line 1303

Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +1 -1
@@ -1299,7 +1299,7 @@ static enum drm_connector_status ast_connector_detect(struct drm_connector
  	int r;
 
  	r = ast_get_modes(connector);
-	if (r < 0)
+	if (r <= 0)
  		return connector_status_disconnected;

Thanks for caring.

I thought about the case of (r == 0) when reviewing the patch that added it, but found it to be correct. If (r < 0) it's clearly an error and we should return 'disconnected'. If (r == 0), we were able to retrieve the EDID, but could not find any meaningful modes. Still, it's 'connected'.

Unless there is a concrete bug where the status is mis-detected, I think that the current code is correct.

Best regards
Thomas

Quoted 3 lines
drivers/gpu/drm/ast/ast_mode.c +0 -0
  	return connector_status_connected;
 
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
author
#2 lore raw
Quoted 28 lines · Thomas Zimmermann <[email protected]> 于2021年7月16日周五 下午2:29写道:

Hi

Am 16.07.21 um 03:56 schrieb [email protected]:

Quoted 15 lines

From: "Ainux.Wang" <[email protected]>

The function ast_get_modes() will also return 0, when it try to get the edid, but it also do not get the edid.

---
  drivers/gpu/drm/ast/ast_mode.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ast/ast_mode.c +0 -0
index e5996ae03c49..b7dcf7821ec6 100644

drivers/gpu/drm/ast/ast_mode.c static enum drm_connector_status ast_connector_detect(struct drm_connector · line 1303

Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +1 -1
@@ -1299,7 +1299,7 @@ static enum drm_connector_status ast_connector_detect(struct drm_connector
      int r;
 
      r = ast_get_modes(connector);
-     if (r < 0)
+     if (r <= 0)
              return connector_status_disconnected;

Thanks for caring.

Quoted 5 lines

I thought about the case of (r == 0) when reviewing the patch that added it, but found it to be correct. If (r < 0) it's clearly an error and we should return 'disconnected'. If (r == 0), we were able to retrieve the EDID, but could not find any meaningful modes. Still, it's 'connected'.

Hi,Thomas
Thanks review.
I see, the drm_add_edid_modes() will retrun0 in ast_get_modes(). Best regards,
Ainux Wang.

Quoted 18 lines

Unless there is a concrete bug where the status is mis-detected, I think that the current code is correct.

Best regards
Thomas

drivers/gpu/drm/ast/ast_mode.c static enum drm_connector_status ast_connector_detect(struct drm_connector · line 1305

Quoted 3 lines
drivers/gpu/drm/ast/ast_mode.c +0 -0
      return connector_status_connected;
 

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

maintainer Acked-by on v1 1/1
#3 lore raw
In reply to [email protected]

Hi

Am 16.07.21 um 03:56 schrieb [email protected]:

Quoted 6 lines

From: "Ainux.Wang" <[email protected]>

The function ast_get_modes() will also return 0, when it try to get the edid, but it also do not get the edid.

after the issue has been discussed a bit. I'll merge the patch into drm-misc-next soon.

Best regards
Thomas

Quoted 18 lines
---
  drivers/gpu/drm/ast/ast_mode.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ast/ast_mode.c +1 -1
index e5996ae03c49..b7dcf7821ec6 100644
@@ -1299,7 +1299,7 @@ static enum drm_connector_status ast_connector_detect(struct drm_connector
  	int r;
 
  	r = ast_get_modes(connector);
-	if (r < 0)
+	if (r <= 0)
  		return connector_status_disconnected;
 
  	return connector_status_connected;
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer