stm32: fix faulty access to non existing layer. This disables operation that requires double layer support, when configured for single layer only.

Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
This commit is contained in:
Gregory Nutt 2014-12-29 09:45:30 -06:00
parent 23ac4caf5a
commit 171c017a0c

View File

@ -2906,8 +2906,10 @@ static int stm32_getarea(FAR struct ltdc_layer_s *layer,
static int stm32_update(FAR struct ltdc_layer_s *layer, uint32_t mode)
{
FAR struct stm32_layer_s *priv = (FAR struct stm32_layer_s *)layer;
#ifdef CONFIG_STM32_LTDC_L2
FAR struct stm32_layer_s *active = &LAYER(g_lactive);
FAR struct stm32_layer_s *inactive = &LAYER(!g_lactive);
#endif
gvdbg("layer = %p, mode = %08x\n", layer, mode);
@ -2932,6 +2934,11 @@ static int stm32_update(FAR struct ltdc_layer_s *layer, uint32_t mode)
stm32_ltdc_lupdate(priv);
#ifdef CONFIG_STM32_LTDC_L2
/* The following operation only useful if layer 2 is supported.
* Otherwise ignore it.
*/
if (mode & LTDC_UPDATE_SIM)
{
/* Also update the flip layer */
@ -2989,6 +2996,7 @@ static int stm32_update(FAR struct ltdc_layer_s *layer, uint32_t mode)
g_lactive = inactive->state.lid;
}
#endif
/* Make the changes visible */