Commit da9df2f4 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'topic/core-stuff-2014-12-10' of git://anongit.freedesktop.org/drm-intel into drm-next

Merge drm core fixes from Daniel.

* tag 'topic/core-stuff-2014-12-10' of git://anongit.freedesktop.org/drm-intel:
  drm: Zero out DRM object memory upon cleanup
  drm: fix a typo in a comment
  drm: fix a word repetition in a comment
  drm: Fix memory leak at error path of drm_read()
  drm/Documentation: Fix rowspan value in drm-kms-properties
  drm/edid: Restore kerneldoc consistency
  drm/edid: new drm_edid_block_checksum helper function V3
  drm/edid: shorten log output in case of all zeroes edid block
  drm/edid: move drm_edid_is_zero to top, make edid argument const
parents d1b8792b a18c0af1
...@@ -2550,7 +2550,7 @@ void intel_crt_init(struct drm_device *dev) ...@@ -2550,7 +2550,7 @@ void intel_crt_init(struct drm_device *dev)
<td valign="top" >Description/Restrictions</td> <td valign="top" >Description/Restrictions</td>
</tr> </tr>
<tr> <tr>
<td rowspan="23" valign="top" >DRM</td> <td rowspan="25" valign="top" >DRM</td>
<td rowspan="4" valign="top" >Generic</td> <td rowspan="4" valign="top" >Generic</td>
<td valign="top" >“EDID”</td> <td valign="top" >“EDID”</td>
<td valign="top" >BLOB | IMMUTABLE</td> <td valign="top" >BLOB | IMMUTABLE</td>
......
...@@ -725,6 +725,8 @@ void drm_crtc_cleanup(struct drm_crtc *crtc) ...@@ -725,6 +725,8 @@ void drm_crtc_cleanup(struct drm_crtc *crtc)
WARN_ON(crtc->state && !crtc->funcs->atomic_destroy_state); WARN_ON(crtc->state && !crtc->funcs->atomic_destroy_state);
if (crtc->state && crtc->funcs->atomic_destroy_state) if (crtc->state && crtc->funcs->atomic_destroy_state)
crtc->funcs->atomic_destroy_state(crtc, crtc->state); crtc->funcs->atomic_destroy_state(crtc, crtc->state);
memset(crtc, 0, sizeof(*crtc));
} }
EXPORT_SYMBOL(drm_crtc_cleanup); EXPORT_SYMBOL(drm_crtc_cleanup);
...@@ -932,6 +934,8 @@ void drm_connector_cleanup(struct drm_connector *connector) ...@@ -932,6 +934,8 @@ void drm_connector_cleanup(struct drm_connector *connector)
if (connector->state && connector->funcs->atomic_destroy_state) if (connector->state && connector->funcs->atomic_destroy_state)
connector->funcs->atomic_destroy_state(connector, connector->funcs->atomic_destroy_state(connector,
connector->state); connector->state);
memset(connector, 0, sizeof(*connector));
} }
EXPORT_SYMBOL(drm_connector_cleanup); EXPORT_SYMBOL(drm_connector_cleanup);
...@@ -1073,6 +1077,8 @@ void drm_bridge_cleanup(struct drm_bridge *bridge) ...@@ -1073,6 +1077,8 @@ void drm_bridge_cleanup(struct drm_bridge *bridge)
list_del(&bridge->head); list_del(&bridge->head);
dev->mode_config.num_bridge--; dev->mode_config.num_bridge--;
drm_modeset_unlock_all(dev); drm_modeset_unlock_all(dev);
memset(bridge, 0, sizeof(*bridge));
} }
EXPORT_SYMBOL(drm_bridge_cleanup); EXPORT_SYMBOL(drm_bridge_cleanup);
...@@ -1139,10 +1145,11 @@ void drm_encoder_cleanup(struct drm_encoder *encoder) ...@@ -1139,10 +1145,11 @@ void drm_encoder_cleanup(struct drm_encoder *encoder)
drm_modeset_lock_all(dev); drm_modeset_lock_all(dev);
drm_mode_object_put(dev, &encoder->base); drm_mode_object_put(dev, &encoder->base);
kfree(encoder->name); kfree(encoder->name);
encoder->name = NULL;
list_del(&encoder->head); list_del(&encoder->head);
dev->mode_config.num_encoder--; dev->mode_config.num_encoder--;
drm_modeset_unlock_all(dev); drm_modeset_unlock_all(dev);
memset(encoder, 0, sizeof(*encoder));
} }
EXPORT_SYMBOL(drm_encoder_cleanup); EXPORT_SYMBOL(drm_encoder_cleanup);
...@@ -1262,6 +1269,8 @@ void drm_plane_cleanup(struct drm_plane *plane) ...@@ -1262,6 +1269,8 @@ void drm_plane_cleanup(struct drm_plane *plane)
WARN_ON(plane->state && !plane->funcs->atomic_destroy_state); WARN_ON(plane->state && !plane->funcs->atomic_destroy_state);
if (plane->state && plane->funcs->atomic_destroy_state) if (plane->state && plane->funcs->atomic_destroy_state)
plane->funcs->atomic_destroy_state(plane, plane->state); plane->funcs->atomic_destroy_state(plane, plane->state);
memset(plane, 0, sizeof(*plane));
} }
EXPORT_SYMBOL(drm_plane_cleanup); EXPORT_SYMBOL(drm_plane_cleanup);
...@@ -3454,7 +3463,7 @@ void drm_fb_release(struct drm_file *priv) ...@@ -3454,7 +3463,7 @@ void drm_fb_release(struct drm_file *priv)
/* /*
* When the file gets released that means no one else can access the fb * When the file gets released that means no one else can access the fb
* list any more, so no need to grab fpriv->fbs_lock. And we need to to * list any more, so no need to grab fpriv->fbs_lock. And we need to
* avoid upsetting lockdep since the universal cursor code adds a * avoid upsetting lockdep since the universal cursor code adds a
* framebuffer while holding mutex locks. * framebuffer while holding mutex locks.
* *
......
...@@ -1017,6 +1017,25 @@ MODULE_PARM_DESC(edid_fixup, ...@@ -1017,6 +1017,25 @@ MODULE_PARM_DESC(edid_fixup,
static void drm_get_displayid(struct drm_connector *connector, static void drm_get_displayid(struct drm_connector *connector,
struct edid *edid); struct edid *edid);
static int drm_edid_block_checksum(const u8 *raw_edid)
{
int i;
u8 csum = 0;
for (i = 0; i < EDID_LENGTH; i++)
csum += raw_edid[i];
return csum;
}
static bool drm_edid_is_zero(const u8 *in_edid, int length)
{
if (memchr_inv(in_edid, 0, length))
return false;
return true;
}
/** /**
* drm_edid_block_valid - Sanity check the EDID block (base or extension) * drm_edid_block_valid - Sanity check the EDID block (base or extension)
* @raw_edid: pointer to raw EDID block * @raw_edid: pointer to raw EDID block
...@@ -1030,8 +1049,7 @@ static void drm_get_displayid(struct drm_connector *connector, ...@@ -1030,8 +1049,7 @@ static void drm_get_displayid(struct drm_connector *connector,
*/ */
bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid)
{ {
int i; u8 csum;
u8 csum = 0;
struct edid *edid = (struct edid *)raw_edid; struct edid *edid = (struct edid *)raw_edid;
if (WARN_ON(!raw_edid)) if (WARN_ON(!raw_edid))
...@@ -1051,8 +1069,7 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) ...@@ -1051,8 +1069,7 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid)
} }
} }
for (i = 0; i < EDID_LENGTH; i++) csum = drm_edid_block_checksum(raw_edid);
csum += raw_edid[i];
if (csum) { if (csum) {
if (print_bad_edid) { if (print_bad_edid) {
DRM_ERROR("EDID checksum is invalid, remainder is %d\n", csum); DRM_ERROR("EDID checksum is invalid, remainder is %d\n", csum);
...@@ -1083,9 +1100,13 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) ...@@ -1083,9 +1100,13 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid)
bad: bad:
if (print_bad_edid) { if (print_bad_edid) {
printk(KERN_ERR "Raw EDID:\n"); if (drm_edid_is_zero(raw_edid, EDID_LENGTH)) {
print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1, printk(KERN_ERR "EDID block is all zeroes\n");
} else {
printk(KERN_ERR "Raw EDID:\n");
print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1,
raw_edid, EDID_LENGTH, false); raw_edid, EDID_LENGTH, false);
}
} }
return false; return false;
} }
...@@ -1118,7 +1139,7 @@ EXPORT_SYMBOL(drm_edid_is_valid); ...@@ -1118,7 +1139,7 @@ EXPORT_SYMBOL(drm_edid_is_valid);
#define DDC_SEGMENT_ADDR 0x30 #define DDC_SEGMENT_ADDR 0x30
/** /**
* drm_do_probe_ddc_edid() - get EDID information via I2C * drm_do_probe_ddc_edid() - get EDID information via I2C
* @adapter: I2C device adaptor * @data: I2C device adapter
* @buf: EDID data buffer to be filled * @buf: EDID data buffer to be filled
* @block: 128 byte EDID block to start fetching from * @block: 128 byte EDID block to start fetching from
* @len: EDID data buffer length to fetch * @len: EDID data buffer length to fetch
...@@ -1179,14 +1200,6 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len) ...@@ -1179,14 +1200,6 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
return ret == xfers ? 0 : -1; return ret == xfers ? 0 : -1;
} }
static bool drm_edid_is_zero(u8 *in_edid, int length)
{
if (memchr_inv(in_edid, 0, length))
return false;
return true;
}
/** /**
* drm_do_get_edid - get EDID data using a custom EDID block read function * drm_do_get_edid - get EDID data using a custom EDID block read function
* @connector: connector we're probing * @connector: connector we're probing
......
...@@ -527,6 +527,7 @@ ssize_t drm_read(struct file *filp, char __user *buffer, ...@@ -527,6 +527,7 @@ ssize_t drm_read(struct file *filp, char __user *buffer,
if (copy_to_user(buffer + total, if (copy_to_user(buffer + total,
e->event, e->event->length)) { e->event, e->event->length)) {
total = -EFAULT; total = -EFAULT;
e->destroy(e);
break; break;
} }
......
...@@ -166,7 +166,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc) ...@@ -166,7 +166,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
spin_lock_irqsave(&dev->vblank_time_lock, irqflags); spin_lock_irqsave(&dev->vblank_time_lock, irqflags);
/* /*
* If the vblank interrupt was already disbled update the count * If the vblank interrupt was already disabled update the count
* and timestamp to maintain the appearance that the counter * and timestamp to maintain the appearance that the counter
* has been ticking all along until this time. This makes the * has been ticking all along until this time. This makes the
* count account for the entire time between drm_vblank_on() and * count account for the entire time between drm_vblank_on() and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment