Squashed commit of the following:
STM32, STM32 F7: LTDC and DMA2D drivers are not permitted to set the errno. SIM LPC31xx: Serial and console drivers are not permitted to set the errno. SAMv7, STM32, STM32 L4: DAC and ADC drivers are not permitted to set the errno.
This commit is contained in:
parent
e4dd33280d
commit
c11345ad4b
@ -621,8 +621,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
break;
|
||||
|
||||
default:
|
||||
errno = ENOTTY;
|
||||
ret = ERROR;
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -627,7 +627,6 @@ FAR struct dac_dev_s *sam_dac_initialize(int intf)
|
||||
#endif
|
||||
{
|
||||
aerr("ERROR: No such DAC interface: %d\n", intf);
|
||||
errno = ENODEV;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -637,7 +636,6 @@ FAR struct dac_dev_s *sam_dac_initialize(int intf)
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: Failed to initialize the DAC peripheral module: %d\n", ret);
|
||||
errno = -ret;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -648,7 +646,6 @@ FAR struct dac_dev_s *sam_dac_initialize(int intf)
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: Failed to initialize DAC channel %d: %d\n", intf, ret);
|
||||
errno = -ret;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2705,14 +2705,12 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg)
|
||||
ret = adc_ioc_wait_rcnr_zeroed(priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
set_errno(-ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = adc_set_ch(dev, ch);
|
||||
if (ret < 0)
|
||||
{
|
||||
set_errno(-ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1587,7 +1587,6 @@ FAR struct dac_dev_s *stm32_dacinitialize(int intf)
|
||||
#endif /* CONFIG_STM32_DAC2CH1 */
|
||||
{
|
||||
aerr("ERROR: No such DAC interface: %d\n", intf);
|
||||
errno = ENODEV;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1597,7 +1596,6 @@ FAR struct dac_dev_s *stm32_dacinitialize(int intf)
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: Failed to initialize the DAC block: %d\n", ret);
|
||||
errno = -ret;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1608,7 +1606,6 @@ FAR struct dac_dev_s *stm32_dacinitialize(int intf)
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: Failed to initialize DAC channel %d: %d\n", intf, ret);
|
||||
errno = -ret;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1945,7 +1945,7 @@ static int stm32_dma2dfillarea(FAR struct dma2d_layer_s *layer,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct dma2d_layer_s * up_dma2dgetlayer(int lid)
|
||||
FAR struct dma2d_layer_s *up_dma2dgetlayer(int lid)
|
||||
{
|
||||
if (lid < DMA2D_LAYER_NSIZE)
|
||||
{
|
||||
@ -1957,8 +1957,7 @@ FAR struct dma2d_layer_s * up_dma2dgetlayer(int lid)
|
||||
return &priv->dma2d;
|
||||
}
|
||||
|
||||
lcderr("ERROR: EINVAL, Unknown layer identifier\n");
|
||||
errno = EINVAL;
|
||||
lcderr("ERROR: lid invalid: %d\n", lid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1975,10 +1974,7 @@ FAR struct dma2d_layer_s * up_dma2dgetlayer(int lid)
|
||||
*
|
||||
* Return:
|
||||
* On success - A valid dma2d layer reference
|
||||
* On error - NULL and errno is set to
|
||||
* -EINVAL if one of the parameter is invalid
|
||||
* -ENOMEM if no memory available or exceeds
|
||||
* CONFIG_STM32_DMA2D_NLAYERS
|
||||
* On error - NULL
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -1986,11 +1982,11 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
|
||||
fb_coord_t height,
|
||||
uint8_t fmt)
|
||||
{
|
||||
FAR struct stm32_dma2d_s *layer = NULL;
|
||||
int ret;
|
||||
int lid;
|
||||
uint8_t fmtmap;
|
||||
uint8_t bpp = 0;
|
||||
FAR struct stm32_dma2d_s *layer = NULL;
|
||||
|
||||
lcdinfo("width=%d, height=%d, fmt=%02x \n", width, height, fmt);
|
||||
|
||||
@ -2000,7 +1996,6 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
|
||||
|
||||
if (ret != OK)
|
||||
{
|
||||
errno = -ret;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2069,24 +2064,21 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* free the layer struture */
|
||||
/* Free the layer struture */
|
||||
|
||||
lcderr("ERROR: ENOMEM, Unable to allocate layer buffer\n");
|
||||
kmm_free(layer);
|
||||
layer = NULL;
|
||||
lcderr("ERROR: ENOMEM, Unable to allocate layer buffer\n");
|
||||
errno = ENOMEM;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lcderr("ERROR: ENOMEM, unable to allocate layer structure\n");
|
||||
errno = ENOMEM;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lcderr("ERROR: EINVAL, no free layer available\n");
|
||||
errno = EINVAL;
|
||||
}
|
||||
|
||||
sem_post(&g_lock);
|
||||
@ -2262,12 +2254,11 @@ void up_dma2duninitialize(void)
|
||||
*
|
||||
* Return:
|
||||
* On success - A valid dma2d layer reference
|
||||
* On error - NULL and errno is set to
|
||||
* -EINVAL if one of the parameter is invalid
|
||||
* On error - NULL
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct dma2d_layer_s * stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer)
|
||||
FAR struct dma2d_layer_s *stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer)
|
||||
{
|
||||
int ret;
|
||||
uint8_t fmt = 0;
|
||||
@ -2282,7 +2273,6 @@ FAR struct dma2d_layer_s * stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer)
|
||||
{
|
||||
lcderr("ERROR: Returning -EINVAL, unsupported pixel format: %d\n",
|
||||
layer->vinfo.fmt);
|
||||
errno = -EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -3432,8 +3432,7 @@ FAR struct ltdc_layer_s *stm32_ltdcgetlayer(int lid)
|
||||
return (FAR struct ltdc_layer_s *) &LAYER(lid);
|
||||
}
|
||||
|
||||
lcderr("ERROR: Returning EINVAL\n");
|
||||
errno = EINVAL;
|
||||
lcderr("ERROR: lid invalid: %d\n", lid);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_STM32_LTDC_INTERFACE */
|
||||
|
@ -1939,7 +1939,7 @@ static int stm32_dma2dfillarea(FAR struct dma2d_layer_s *layer,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct dma2d_layer_s * up_dma2dgetlayer(int lid)
|
||||
FAR struct dma2d_layer_s *up_dma2dgetlayer(int lid)
|
||||
{
|
||||
if (lid < DMA2D_LAYER_NSIZE)
|
||||
{
|
||||
@ -1951,8 +1951,7 @@ FAR struct dma2d_layer_s * up_dma2dgetlayer(int lid)
|
||||
return &priv->dma2d;
|
||||
}
|
||||
|
||||
lcderr("ERROR: EINVAL, Unknown layer identifier\n");
|
||||
errno = EINVAL;
|
||||
lcderr("ERROR: lid invalid: %d\n", lid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1969,10 +1968,7 @@ FAR struct dma2d_layer_s * up_dma2dgetlayer(int lid)
|
||||
*
|
||||
* Return:
|
||||
* On success - A valid dma2d layer reference
|
||||
* On error - NULL and errno is set to
|
||||
* -EINVAL if one of the parameter is invalid
|
||||
* -ENOMEM if no memory available or exceeds
|
||||
* CONFIG_STM32F7_DMA2D_NLAYERS
|
||||
* On error - NULL
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -1980,11 +1976,11 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
|
||||
fb_coord_t height,
|
||||
uint8_t fmt)
|
||||
{
|
||||
FAR struct stm32_dma2d_s *layer = NULL;
|
||||
int ret;
|
||||
int lid;
|
||||
uint8_t fmtmap;
|
||||
uint8_t bpp = 0;
|
||||
FAR struct stm32_dma2d_s *layer = NULL;
|
||||
|
||||
lcdinfo("width=%d, height=%d, fmt=%02x \n", width, height, fmt);
|
||||
|
||||
@ -1994,7 +1990,6 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
|
||||
|
||||
if (ret != OK)
|
||||
{
|
||||
errno = -ret;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2066,19 +2061,16 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
|
||||
kmm_free(layer);
|
||||
layer = NULL;
|
||||
lcderr("ERROR: ENOMEM, Unable to allocate layer buffer\n");
|
||||
errno = ENOMEM;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lcderr("ERROR: ENOMEM, unable to allocate layer structure\n");
|
||||
errno = ENOMEM;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lcderr("ERROR: EINVAL, no free layer available\n");
|
||||
errno = EINVAL;
|
||||
}
|
||||
|
||||
sem_post(&g_lock);
|
||||
@ -2254,12 +2246,11 @@ void up_dma2duninitialize(void)
|
||||
*
|
||||
* Return:
|
||||
* On success - A valid dma2d layer reference
|
||||
* On error - NULL and errno is set to
|
||||
* -EINVAL if one of the parameter is invalid
|
||||
* On error - NULL
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct dma2d_layer_s * stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer)
|
||||
FAR struct dma2d_layer_s *stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer)
|
||||
{
|
||||
int ret;
|
||||
uint8_t fmt = 0;
|
||||
|
@ -3431,8 +3431,7 @@ FAR struct ltdc_layer_s *stm32_ltdcgetlayer(int lid)
|
||||
return (FAR struct ltdc_layer_s *) &LAYER(lid);
|
||||
}
|
||||
|
||||
lcderr("ERROR: Returning EINVAL\n");
|
||||
errno = EINVAL;
|
||||
lcderr("ERROR: lid invalid: %d\n", lid);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_STM32F7_LTDC_INTERFACE */
|
||||
|
@ -1181,7 +1181,6 @@ FAR struct dac_dev_s *stm32l4_dacinitialize(int intf)
|
||||
#endif
|
||||
default:
|
||||
aerr("ERROR: No such DAC interface: %d\n", intf);
|
||||
errno = ENODEV;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1196,7 +1195,6 @@ FAR struct dac_dev_s *stm32l4_dacinitialize(int intf)
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: Failed to initialize DAC channel %d: %d\n", intf, ret);
|
||||
errno = -ret;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,7 @@ static ssize_t devconsole_write(struct file *filep, const char *buffer, size_t l
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
set_errno(EIO);
|
||||
return ERROR;
|
||||
return -ret;
|
||||
}
|
||||
|
||||
return len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user