From 2aa9d2bc8cc3ab32ea0d15ec9005f25b1af3465a Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Thu, 26 Jun 2014 21:37:20 +0200 Subject: [PATCH 1/6] drm: Fix function names in kerneldoc The drm_property_create_enum(), drm_property_create_bitmask() and drm_property_create_range() contain the wrong name in the kerneldoc comment. This is probably simply a copy/paste mistake. Signed-off-by: Thierry Reding Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index c808a092d8241..1ccf5cb9aa869 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -3388,7 +3388,7 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags, EXPORT_SYMBOL(drm_property_create); /** - * drm_property_create - create a new enumeration property type + * drm_property_create_enum - create a new enumeration property type * @dev: drm device * @flags: flags specifying the property type * @name: name of the property @@ -3434,7 +3434,7 @@ struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags, EXPORT_SYMBOL(drm_property_create_enum); /** - * drm_property_create - create a new bitmask property type + * drm_property_create_bitmask - create a new bitmask property type * @dev: drm device * @flags: flags specifying the property type * @name: name of the property @@ -3496,7 +3496,7 @@ static struct drm_property *property_create_range(struct drm_device *dev, } /** - * drm_property_create - create a new ranged property type + * drm_property_create_range - create a new ranged property type * @dev: drm device * @flags: flags specifying the property type * @name: name of the property From 74f20788a7637f03bb877a178ef2c8f34a722c26 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Sat, 28 Jun 2014 15:20:43 +0200 Subject: [PATCH 2/6] drivers/gpu/drm/drm_buffer.c: remove unnecessary null test before kfree This patch removes special case of last element and loops from idx to 0. Cc: David Airlie Cc: dri-devel@lists.freedesktop.org Signed-off-by: Fabian Frederick Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_buffer.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_buffer.c b/drivers/gpu/drm/drm_buffer.c index 0406110f83edd..86a4a4a60afcd 100644 --- a/drivers/gpu/drm/drm_buffer.c +++ b/drivers/gpu/drm/drm_buffer.c @@ -80,11 +80,7 @@ int drm_buffer_alloc(struct drm_buffer **buf, int size) error_out: - /* Only last element can be null pointer so check for it first. */ - if ((*buf)->data[idx]) - kfree((*buf)->data[idx]); - - for (--idx; idx >= 0; --idx) + for (; idx >= 0; --idx) kfree((*buf)->data[idx]); kfree(*buf); From 3281cc7e341b6dc029965c74a8dd3be5e942a63c Mon Sep 17 00:00:00 2001 From: Matt Roper Date: Mon, 30 Jun 2014 15:37:51 -0700 Subject: [PATCH 3/6] drm/plane-helper: Use proper plane init function drm_plane_init() (the legacy plane initialization function) takes a bool as its final parameter; originally this indicated whether a plane was 'private' to the driver (before the DRM core understood non-overlay planes), now it indicates whether the plane is a primary plane (private planes were used by some drivers to represent primary planes internally). The newer drm_universal_plane_init() take an 'enum drm_plane_type' as its final parameter to allow the caller to specify the specific plane type desired (primary, cursor, or overlay). Due to a rebasing mistake, the primary plane helper is currently passing DRM_PLANE_TYPE_PRIMARY (enum value = 1) for drm_plane_init()'s boolean 'is_primary' parameter. This winds up giving the correct behavior since DRM_PLANE_TYPE_PRIMARY evaluates as true, but is confusing to anyone reading the code since we're passing an enum value (one of three possible values) for a boolean parameter. Replace the primary plane helper's call to drm_plane_init() with drm_universal_plane_init() so that the parameter and value types match up as expected. Signed-off-by: Matt Roper Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_plane_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 6d133149cc748..827ec1a3040b2 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -335,9 +335,10 @@ struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev, } /* possible_crtc's will be filled in later by crtc_init */ - ret = drm_plane_init(dev, primary, 0, &drm_primary_helper_funcs, - formats, num_formats, - DRM_PLANE_TYPE_PRIMARY); + ret = drm_universal_plane_init(dev, primary, 0, + &drm_primary_helper_funcs, + formats, num_formats, + DRM_PLANE_TYPE_PRIMARY); if (ret) { kfree(primary); primary = NULL; From 7389ad4b6515c2de6402bfafdfebf0b319790d16 Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Mon, 14 Jul 2014 11:53:44 +0100 Subject: [PATCH 4/6] drm/dp-mst-helper: Avoid reading uninitialized value A static analysis tool tells me that we could try to read an uninitialized 'ret' value. Plug that. Signed-off-by: Damien Lespiau Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_dp_mst_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 369d6c49145b4..813b8d186691e 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -1644,7 +1644,7 @@ int drm_dp_update_payload_part2(struct drm_dp_mst_topology_mgr *mgr) { struct drm_dp_mst_port *port; int i; - int ret; + int ret = 0; mutex_lock(&mgr->payload_lock); for (i = 0; i < mgr->max_payloads; i++) { From bf3719c04ee3322b0f6d13c078e3ca4c3b7e3ead Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Mon, 14 Jul 2014 12:13:18 +0100 Subject: [PATCH 5/6] drm/dp-mst-helper: Don't use uninitialized fields of the sideband message header We could be using uninitialized fields of the header in drm_dp_encode_sideband_msg_hdr(), for instance hdr->somt is set to 1 in the first patcket but never set to 0 otherwise. Always clear the header at the start then. Signed-off-by: Damien Lespiau Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 813b8d186691e..618526db263f8 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -1290,6 +1290,8 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr, int len, space, idx, tosend; int ret; + memset(&hdr, 0, sizeof(struct drm_dp_sideband_msg_hdr)); + if (txmsg->state == DRM_DP_SIDEBAND_TX_QUEUED) { txmsg->seqno = -1; txmsg->state = DRM_DP_SIDEBAND_TX_START_SEND; From 008f40451d0e59f220a4fa13aaf75d04303a01a1 Mon Sep 17 00:00:00 2001 From: Sean Paul Date: Thu, 17 Jul 2014 11:25:18 -0400 Subject: [PATCH 6/6] drm: Check for connection_mutex in drm_select_eld drm_select_eld should check for mode_config.connection_mutex as well as mode_config.mutex: We need that since this function checks conector->encoder links. Signed-off-by: Sean Paul [danvet: Pimp commit message slightly.] Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_edid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index dfa9769b26b5c..087d6080bc1df 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3305,6 +3305,7 @@ struct drm_connector *drm_select_eld(struct drm_encoder *encoder, struct drm_device *dev = encoder->dev; WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); + WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); list_for_each_entry(connector, &dev->mode_config.connector_list, head) if (connector->encoder == encoder && connector->eld[0])