static int drm_crtc_convert_umode(struct drm_display_mode *out,
const struct drm_mode_modeinfo *in)
{
- if (in->clock > INT_MAX || in->vrefresh > INT_MAX)
- return -ERANGE;
+ int ret = -EINVAL;
+
+ if (in->clock > INT_MAX || in->vrefresh > INT_MAX) {
+ ret = -ERANGE;
+ goto out;
+ }
if ((in->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
- return -EINVAL;
+ goto out;
out->clock = in->clock;
out->hdisplay = in->hdisplay;
strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
- return 0;
+ out->status = drm_mode_validate_basic(out);
+ if (out->status != MODE_OK)
+ goto out;
+
+ ret = 0;
+
+out:
+ return ret;
}
/**
goto out;
}
- mode->status = drm_mode_validate_basic(mode);
- if (mode->status != MODE_OK) {
- ret = -EINVAL;
- goto out;
- }
-
drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
/*