drm: Don't initialize local ret variable when not needed
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
committed by
Dave Airlie
parent
7eb3b2c83d
commit
4a1b071427
@@ -1829,7 +1829,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
|
|||||||
struct drm_display_mode *mode = NULL;
|
struct drm_display_mode *mode = NULL;
|
||||||
struct drm_mode_set set;
|
struct drm_mode_set set;
|
||||||
uint32_t __user *set_connectors_ptr;
|
uint32_t __user *set_connectors_ptr;
|
||||||
int ret = 0;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||||
@@ -2248,7 +2248,7 @@ int drm_mode_addfb2(struct drm_device *dev,
|
|||||||
struct drm_mode_fb_cmd2 *r = data;
|
struct drm_mode_fb_cmd2 *r = data;
|
||||||
struct drm_mode_config *config = &dev->mode_config;
|
struct drm_mode_config *config = &dev->mode_config;
|
||||||
struct drm_framebuffer *fb;
|
struct drm_framebuffer *fb;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -2403,7 +2403,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
|
|||||||
struct drm_framebuffer *fb;
|
struct drm_framebuffer *fb;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
int num_clips;
|
int num_clips;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -2602,7 +2602,7 @@ int drm_mode_attachmode_ioctl(struct drm_device *dev,
|
|||||||
struct drm_display_mode *mode;
|
struct drm_display_mode *mode;
|
||||||
struct drm_mode_object *obj;
|
struct drm_mode_object *obj;
|
||||||
struct drm_mode_modeinfo *umode = &mode_cmd->mode;
|
struct drm_mode_modeinfo *umode = &mode_cmd->mode;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -2656,7 +2656,7 @@ int drm_mode_detachmode_ioctl(struct drm_device *dev,
|
|||||||
struct drm_connector *connector;
|
struct drm_connector *connector;
|
||||||
struct drm_display_mode mode;
|
struct drm_display_mode mode;
|
||||||
struct drm_mode_modeinfo *umode = &mode_cmd->mode;
|
struct drm_mode_modeinfo *umode = &mode_cmd->mode;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -3065,7 +3065,7 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,
|
|||||||
struct edid *edid)
|
struct edid *edid)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = connector->dev;
|
struct drm_device *dev = connector->dev;
|
||||||
int ret = 0, size;
|
int ret, size;
|
||||||
|
|
||||||
if (connector->edid_blob_ptr)
|
if (connector->edid_blob_ptr)
|
||||||
drm_property_destroy_blob(dev, connector->edid_blob_ptr);
|
drm_property_destroy_blob(dev, connector->edid_blob_ptr);
|
||||||
|
|||||||
@@ -518,7 +518,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
|
|||||||
int count = 0, ro, fail = 0;
|
int count = 0, ro, fail = 0;
|
||||||
struct drm_crtc_helper_funcs *crtc_funcs;
|
struct drm_crtc_helper_funcs *crtc_funcs;
|
||||||
struct drm_mode_set save_set;
|
struct drm_mode_set save_set;
|
||||||
int ret = 0;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
DRM_DEBUG_KMS("\n");
|
DRM_DEBUG_KMS("\n");
|
||||||
|
|||||||
@@ -220,18 +220,18 @@ int drm_load_edid_firmware(struct drm_connector *connector)
|
|||||||
{
|
{
|
||||||
char *connector_name = drm_get_connector_name(connector);
|
char *connector_name = drm_get_connector_name(connector);
|
||||||
char *edidname = edid_firmware, *last, *colon;
|
char *edidname = edid_firmware, *last, *colon;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
if (*edidname == '\0')
|
if (*edidname == '\0')
|
||||||
return ret;
|
return 0;
|
||||||
|
|
||||||
colon = strchr(edidname, ':');
|
colon = strchr(edidname, ':');
|
||||||
if (colon != NULL) {
|
if (colon != NULL) {
|
||||||
if (strncmp(connector_name, edidname, colon - edidname))
|
if (strncmp(connector_name, edidname, colon - edidname))
|
||||||
return ret;
|
return 0;
|
||||||
edidname = colon + 1;
|
edidname = colon + 1;
|
||||||
if (*edidname == '\0')
|
if (*edidname == '\0')
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
last = edidname + strlen(edidname) - 1;
|
last = edidname + strlen(edidname) - 1;
|
||||||
|
|||||||
@@ -383,7 +383,6 @@ int drm_fb_helper_init(struct drm_device *dev,
|
|||||||
int crtc_count, int max_conn_count)
|
int crtc_count, int max_conn_count)
|
||||||
{
|
{
|
||||||
struct drm_crtc *crtc;
|
struct drm_crtc *crtc;
|
||||||
int ret = 0;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
fb_helper->dev = dev;
|
fb_helper->dev = dev;
|
||||||
@@ -408,10 +407,8 @@ int drm_fb_helper_init(struct drm_device *dev,
|
|||||||
sizeof(struct drm_connector *),
|
sizeof(struct drm_connector *),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
|
||||||
if (!fb_helper->crtc_info[i].mode_set.connectors) {
|
if (!fb_helper->crtc_info[i].mode_set.connectors)
|
||||||
ret = -ENOMEM;
|
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
|
||||||
fb_helper->crtc_info[i].mode_set.num_connectors = 0;
|
fb_helper->crtc_info[i].mode_set.num_connectors = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ drm_gem_create_mmap_offset(struct drm_gem_object *obj)
|
|||||||
struct drm_gem_mm *mm = dev->mm_private;
|
struct drm_gem_mm *mm = dev->mm_private;
|
||||||
struct drm_map_list *list;
|
struct drm_map_list *list;
|
||||||
struct drm_local_map *map;
|
struct drm_local_map *map;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
/* Set the object up for mmap'ing */
|
/* Set the object up for mmap'ing */
|
||||||
list = &obj->map_list;
|
list = &obj->map_list;
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state)
|
|||||||
*/
|
*/
|
||||||
int drm_irq_install(struct drm_device *dev)
|
int drm_irq_install(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret;
|
||||||
unsigned long sh_flags = 0;
|
unsigned long sh_flags = 0;
|
||||||
char *irqname;
|
char *irqname;
|
||||||
|
|
||||||
@@ -731,7 +731,7 @@ EXPORT_SYMBOL(drm_calc_vbltimestamp_from_scanoutpos);
|
|||||||
u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
|
u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
|
||||||
struct timeval *tvblank, unsigned flags)
|
struct timeval *tvblank, unsigned flags)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
/* Define requested maximum error on timestamps (nanoseconds). */
|
/* Define requested maximum error on timestamps (nanoseconds). */
|
||||||
int max_error = (int) drm_timestamp_precision * 1000;
|
int max_error = (int) drm_timestamp_precision * 1000;
|
||||||
@@ -1031,18 +1031,15 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,
|
|||||||
struct drm_file *file_priv)
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
struct drm_modeset_ctl *modeset = data;
|
struct drm_modeset_ctl *modeset = data;
|
||||||
int ret = 0;
|
|
||||||
unsigned int crtc;
|
unsigned int crtc;
|
||||||
|
|
||||||
/* If drm_vblank_init() hasn't been called yet, just no-op */
|
/* If drm_vblank_init() hasn't been called yet, just no-op */
|
||||||
if (!dev->num_crtcs)
|
if (!dev->num_crtcs)
|
||||||
goto out;
|
return 0;
|
||||||
|
|
||||||
crtc = modeset->crtc;
|
crtc = modeset->crtc;
|
||||||
if (crtc >= dev->num_crtcs) {
|
if (crtc >= dev->num_crtcs)
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (modeset->cmd) {
|
switch (modeset->cmd) {
|
||||||
case _DRM_PRE_MODESET:
|
case _DRM_PRE_MODESET:
|
||||||
@@ -1052,12 +1049,10 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,
|
|||||||
drm_vblank_post_modeset(dev, crtc);
|
drm_vblank_post_modeset(dev, crtc);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
|
static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
|
||||||
@@ -1154,7 +1149,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
|
|||||||
struct drm_file *file_priv)
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
union drm_wait_vblank *vblwait = data;
|
union drm_wait_vblank *vblwait = data;
|
||||||
int ret = 0;
|
int ret;
|
||||||
unsigned int flags, seq, crtc, high_crtc;
|
unsigned int flags, seq, crtc, high_crtc;
|
||||||
|
|
||||||
if ((!drm_dev_to_irq(dev)) || (!dev->irq_enabled))
|
if ((!drm_dev_to_irq(dev)) || (!dev->irq_enabled))
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ static int drm_notifier(void *priv)
|
|||||||
|
|
||||||
void drm_idlelock_take(struct drm_lock_data *lock_data)
|
void drm_idlelock_take(struct drm_lock_data *lock_data)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
spin_lock_bh(&lock_data->spinlock);
|
spin_lock_bh(&lock_data->spinlock);
|
||||||
lock_data->kernel_waiters++;
|
lock_data->kernel_waiters++;
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ EXPORT_SYMBOL(drm_master_put);
|
|||||||
int drm_setmaster_ioctl(struct drm_device *dev, void *data,
|
int drm_setmaster_ioctl(struct drm_device *dev, void *data,
|
||||||
struct drm_file *file_priv)
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
if (file_priv->is_master)
|
if (file_priv->is_master)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
|
|||||||
int attr_cnt = 0;
|
int attr_cnt = 0;
|
||||||
int opt_cnt = 0;
|
int opt_cnt = 0;
|
||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
/* We shouldn't get called more than once for the same connector */
|
/* We shouldn't get called more than once for the same connector */
|
||||||
BUG_ON(device_is_registered(&connector->kdev));
|
BUG_ON(device_is_registered(&connector->kdev));
|
||||||
|
|||||||
Reference in New Issue
Block a user