@ -4292,6 +4292,7 @@ drm_output_destroy(struct weston_output *base)
*/
*/
if ( output - > cursor_plane )
if ( output - > cursor_plane )
drm_plane_destroy ( output - > cursor_plane ) ;
drm_plane_destroy ( output - > cursor_plane ) ;
if ( output - > scanout_plane )
drm_plane_destroy ( output - > scanout_plane ) ;
drm_plane_destroy ( output - > scanout_plane ) ;
}
}
@ -4436,12 +4437,12 @@ create_output_for_connector(struct drm_backend *b,
i = find_crtc_for_connector ( b , resources , connector ) ;
i = find_crtc_for_connector ( b , resources , connector ) ;
if ( i < 0 ) {
if ( i < 0 ) {
weston_log ( " No usable crtc/encoder pair for connector. \n " ) ;
weston_log ( " No usable crtc/encoder pair for connector. \n " ) ;
goto err ;
goto err_init ;
}
}
output = zalloc ( sizeof * output ) ;
output = zalloc ( sizeof * output ) ;
if ( output = = NULL )
if ( output = = NULL )
goto err ;
goto err_init ;
output - > connector = connector ;
output - > connector = connector ;
output - > crtc_id = resources - > crtcs [ i ] ;
output - > crtc_id = resources - > crtcs [ i ] ;
@ -4468,7 +4469,7 @@ create_output_for_connector(struct drm_backend *b,
DRM_MODE_OBJECT_CONNECTOR ) ;
DRM_MODE_OBJECT_CONNECTOR ) ;
if ( ! props ) {
if ( ! props ) {
weston_log ( " failed to get connector properties \n " ) ;
weston_log ( " failed to get connector properties \n " ) ;
goto err ;
goto err_output ;
}
}
drm_property_info_populate ( b , connector_props , output - > props_conn ,
drm_property_info_populate ( b , connector_props , output - > props_conn ,
WDRM_CONNECTOR__COUNT , props ) ;
WDRM_CONNECTOR__COUNT , props ) ;
@ -4493,8 +4494,8 @@ create_output_for_connector(struct drm_backend *b,
for ( i = 0 ; i < output - > connector - > count_modes ; i + + ) {
for ( i = 0 ; i < output - > connector - > count_modes ; i + + ) {
drm_mode = drm_output_add_mode ( output , & output - > connector - > modes [ i ] ) ;
drm_mode = drm_output_add_mode ( output , & output - > connector - > modes [ i ] ) ;
if ( ! drm_mode ) {
if ( ! drm_mode ) {
drm_output_destroy ( & output - > base ) ;
weston_log ( " failed to add mode \n " ) ;
return - 1 ;
goto err_output ;
}
}
}
}
@ -4504,8 +4505,7 @@ create_output_for_connector(struct drm_backend *b,
if ( ! output - > scanout_plane ) {
if ( ! output - > scanout_plane ) {
weston_log ( " Failed to find primary plane for output %s \n " ,
weston_log ( " Failed to find primary plane for output %s \n " ,
output - > base . name ) ;
output - > base . name ) ;
drm_output_destroy ( & output - > base ) ;
goto err_output ;
return - 1 ;
}
}
/* Failing to find a cursor plane is not fatal, as we'll fall back
/* Failing to find a cursor plane is not fatal, as we'll fall back
@ -4518,9 +4518,13 @@ create_output_for_connector(struct drm_backend *b,
return 0 ;
return 0 ;
err :
err_output :
drmModeFreeConnector ( connector ) ;
drm_output_destroy ( & output - > base ) ;
return - 1 ;
/* no fallthrough! */
err_init :
drmModeFreeConnector ( connector ) ;
return - 1 ;
return - 1 ;
}
}