diff options
author | Eric Anholt <eric@anholt.net> | 2007-08-15 11:04:56 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-08-15 11:06:49 -0700 |
commit | 56133e04de40e3004018d069cb229e62ee10e0f4 (patch) | |
tree | d38446b7d419c2a5329be274b9237ca2faaed481 | |
parent | a23a47b16cf813f0e7e9616ef6eb66f6ae0bc2ac (diff) |
BSD: Fix regression in setversion ioctl (current version not returned).
-rw-r--r-- | bsd-core/drm_ioctl.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/bsd-core/drm_ioctl.c b/bsd-core/drm_ioctl.c index 328f1d1e..d6af4284 100644 --- a/bsd-core/drm_ioctl.c +++ b/bsd-core/drm_ioctl.c @@ -232,23 +232,27 @@ int drm_getstats(drm_device_t *dev, void *data, struct drm_file *file_priv) int drm_setversion(drm_device_t *dev, void *data, struct drm_file *file_priv) { drm_set_version_t *sv = data; - drm_set_version_t retv; + drm_set_version_t ver; int if_version; - retv.drm_di_major = DRM_IF_MAJOR; - retv.drm_di_minor = DRM_IF_MINOR; - retv.drm_dd_major = dev->driver.major; - retv.drm_dd_minor = dev->driver.minor; - - if (sv->drm_di_major != -1) { - if (sv->drm_di_major != DRM_IF_MAJOR || - sv->drm_di_minor < 0 || sv->drm_di_minor > DRM_IF_MINOR) { + /* Save the incoming data, and set the response before continuing + * any further. + */ + ver = *sv; + sv->drm_di_major = DRM_IF_MAJOR; + sv->drm_di_minor = DRM_IF_MINOR; + sv->drm_dd_major = dev->driver.major; + sv->drm_dd_minor = dev->driver.minor; + + if (ver.drm_di_major != -1) { + if (ver.drm_di_major != DRM_IF_MAJOR || + ver.drm_di_minor < 0 || ver.drm_di_minor > DRM_IF_MINOR) { return EINVAL; } - if_version = DRM_IF_VERSION(sv->drm_di_major, - sv->drm_dd_minor); + if_version = DRM_IF_VERSION(ver.drm_di_major, + ver.drm_dd_minor); dev->if_version = DRM_MAX(if_version, dev->if_version); - if (sv->drm_di_minor >= 1) { + if (ver.drm_di_minor >= 1) { /* * Version 1.1 includes tying of DRM to specific device */ @@ -256,10 +260,10 @@ int drm_setversion(drm_device_t *dev, void *data, struct drm_file *file_priv) } } - if (sv->drm_dd_major != -1) { - if (sv->drm_dd_major != dev->driver.major || - sv->drm_dd_minor < 0 || - sv->drm_dd_minor > dev->driver.minor) + if (ver.drm_dd_major != -1) { + if (ver.drm_dd_major != dev->driver.major || + ver.drm_dd_minor < 0 || + ver.drm_dd_minor > dev->driver.minor) { return EINVAL; } |