Skip to content

Commit

Permalink
Merge tag 'drm-misc-next-fixes-2017-04-12' of git://anongit.freedeskt…
Browse files Browse the repository at this point in the history
…op.org/git/drm-misc into drm-next

drm-misc-next-fixes-2017-04-12

Core changes:
 - Fix off-by-one bug in get_property ioctl for enums/bitmasks (Daniel)

Driver changes:
 - Add mode_fixup to dw-hdmi bridge driver to ensure mode is validated (Romain)

* tag 'drm-misc-next-fixes-2017-04-12' of git://anongit.freedesktop.org/git/drm-misc:
  drm: Fix get_property logic fumble
  drm: dw-hdmi: Implement the mode_fixup drm helper
  • Loading branch information
Dave Airlie committed Apr 13, 2017
2 parents ab6eb21 + 8cb68c8 commit a6a5c98
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,20 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge)
return 0;
}

static bool dw_hdmi_bridge_mode_fixup(struct drm_bridge *bridge,
const struct drm_display_mode *orig_mode,
struct drm_display_mode *mode)
{
struct dw_hdmi *hdmi = bridge->driver_private;
struct drm_connector *connector = &hdmi->connector;
enum drm_mode_status status;

status = dw_hdmi_connector_mode_valid(connector, mode);
if (status != MODE_OK)
return false;
return true;
}

static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,
struct drm_display_mode *orig_mode,
struct drm_display_mode *mode)
Expand Down Expand Up @@ -1988,6 +2002,7 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
.enable = dw_hdmi_bridge_enable,
.disable = dw_hdmi_bridge_disable,
.mode_set = dw_hdmi_bridge_mode_set,
.mode_fixup = dw_hdmi_bridge_mode_fixup,
};

static irqreturn_t dw_hdmi_i2c_irq(struct dw_hdmi *hdmi)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_property.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
list_for_each_entry(prop_enum, &property->enum_list, head) {
enum_count++;
if (out_resp->count_enum_blobs <= enum_count)
if (out_resp->count_enum_blobs < enum_count)
continue;

if (copy_to_user(&enum_ptr[copied].value,
Expand Down

0 comments on commit a6a5c98

Please sign in to comment.