radeon_connector_edid() copies the EDID from edid_blob_ptr as a side
effect if radeon_connector->edid isn't initialized. However, everywhere
that the returned EDID is used, the EDID should have been set
beforehands.

Only the drm EDID code should look at the EDID property, anyway, so stop
using it.

Cc: Alex Deucher <alexander.deuc...@amd.com>
Cc: Christian König <christian.koe...@amd.com>
Cc: Pan, Xinhui <xinhui....@amd.com>
Cc: amd-...@lists.freedesktop.org
Signed-off-by: Jani Nikula <jani.nik...@intel.com>
---
 drivers/gpu/drm/radeon/radeon_audio.c      |  7 ++++---
 drivers/gpu/drm/radeon/radeon_connectors.c | 15 ---------------
 drivers/gpu/drm/radeon/radeon_mode.h       |  2 --
 3 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_audio.c 
b/drivers/gpu/drm/radeon/radeon_audio.c
index 16c10db3ce6f..0bcd767b9f47 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -303,6 +303,7 @@ void radeon_audio_endpoint_wreg(struct radeon_device *rdev, 
u32 offset,
 static void radeon_audio_write_sad_regs(struct drm_encoder *encoder)
 {
        struct drm_connector *connector = 
radeon_get_connector_for_encoder(encoder);
+       struct radeon_connector *radeon_connector = 
to_radeon_connector(connector);
        struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
        struct cea_sad *sads;
        int sad_count;
@@ -310,7 +311,7 @@ static void radeon_audio_write_sad_regs(struct drm_encoder 
*encoder)
        if (!connector)
                return;
 
-       sad_count = drm_edid_to_sad(radeon_connector_edid(connector), &sads);
+       sad_count = drm_edid_to_sad(radeon_connector->edid, &sads);
        if (sad_count < 0)
                DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
        if (sad_count <= 0)
@@ -326,6 +327,7 @@ static void radeon_audio_write_sad_regs(struct drm_encoder 
*encoder)
 static void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder)
 {
        struct drm_connector *connector = 
radeon_get_connector_for_encoder(encoder);
+       struct radeon_connector *radeon_connector = 
to_radeon_connector(connector);
        struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
        u8 *sadb = NULL;
        int sad_count;
@@ -333,8 +335,7 @@ static void radeon_audio_write_speaker_allocation(struct 
drm_encoder *encoder)
        if (!connector)
                return;
 
-       sad_count = 
drm_edid_to_speaker_allocation(radeon_connector_edid(connector),
-                                                  &sadb);
+       sad_count = drm_edid_to_speaker_allocation(radeon_connector->edid, 
&sadb);
        if (sad_count < 0) {
                DRM_DEBUG("Couldn't read Speaker Allocation Data Block: %d\n",
                          sad_count);
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index 81b5c3c8f658..80879e946342 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -255,21 +255,6 @@ static struct drm_encoder *radeon_find_encoder(struct 
drm_connector *connector,
        return NULL;
 }
 
-struct edid *radeon_connector_edid(struct drm_connector *connector)
-{
-       struct radeon_connector *radeon_connector = 
to_radeon_connector(connector);
-       struct drm_property_blob *edid_blob = connector->edid_blob_ptr;
-
-       if (radeon_connector->edid) {
-               return radeon_connector->edid;
-       } else if (edid_blob) {
-               struct edid *edid = kmemdup(edid_blob->data, edid_blob->length, 
GFP_KERNEL);
-               if (edid)
-                       radeon_connector->edid = edid;
-       }
-       return radeon_connector->edid;
-}
-
 static void radeon_connector_get_edid(struct drm_connector *connector)
 {
        struct drm_device *dev = connector->dev;
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h 
b/drivers/gpu/drm/radeon/radeon_mode.h
index 546381a5c918..e0a5af180801 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -701,8 +701,6 @@ extern u16 
radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connecto
 extern bool radeon_connector_is_dp12_capable(struct drm_connector *connector);
 extern int radeon_get_monitor_bpc(struct drm_connector *connector);
 
-extern struct edid *radeon_connector_edid(struct drm_connector *connector);
-
 extern void radeon_connector_hotplug(struct drm_connector *connector);
 extern int radeon_dp_mode_valid_helper(struct drm_connector *connector,
                                       struct drm_display_mode *mode);
-- 
2.39.2

Reply via email to