STM32/STM32 F7: Fix some errors found by Coverity.
This commit is contained in:
parent
cca15891c9
commit
13006ecca9
@ -246,9 +246,11 @@ static int stm32_interrupt(int irq, void *context, FAR void *arg)
|
||||
|
||||
static ssize_t stm32_read(struct file *filep, char *buffer, size_t buflen)
|
||||
{
|
||||
if (sem_wait(&g_rngdev.rd_devsem) != OK)
|
||||
int ret;
|
||||
|
||||
if (sem_wait(&g_rngdev.rd_devsem) < 0)
|
||||
{
|
||||
return -errno;
|
||||
return -get_errno();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -272,13 +274,17 @@ static ssize_t stm32_read(struct file *filep, char *buffer, size_t buflen)
|
||||
|
||||
/* Wait until the buffer is filled */
|
||||
|
||||
sem_wait(&g_rngdev.rd_readsem);
|
||||
ret = sem_wait(&g_rngdev.rd_readsem);
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
}
|
||||
|
||||
/* Free RNG for next use */
|
||||
|
||||
sem_post(&g_rngdev.rd_devsem);
|
||||
|
||||
return buflen;
|
||||
return ret < 0 ? ret : buflen;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3369,6 +3369,8 @@ static int stm32_phyinit(struct stm32_ethmac_s *priv)
|
||||
default:
|
||||
nerr("ERROR: Unrecognized PHY status setting\n");
|
||||
|
||||
/* Falls through */
|
||||
|
||||
case CONFIG_STM32F7_PHYSR_10HD:
|
||||
priv->fduplex = 0;
|
||||
priv->mbps100 = 0;
|
||||
|
@ -267,9 +267,11 @@ static int stm32_rnginterrupt(int irq, void *context, FAR void *arg)
|
||||
|
||||
static ssize_t stm32_rngread(struct file *filep, char *buffer, size_t buflen)
|
||||
{
|
||||
if (sem_wait(&g_rngdev.rd_devsem) != OK)
|
||||
int ret;
|
||||
|
||||
if (sem_wait(&g_rngdev.rd_devsem) < 0)
|
||||
{
|
||||
return -errno;
|
||||
return -get_errno();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -293,7 +295,11 @@ static ssize_t stm32_rngread(struct file *filep, char *buffer, size_t buflen)
|
||||
|
||||
/* Wait until the buffer is filled */
|
||||
|
||||
sem_wait(&g_rngdev.rd_readsem);
|
||||
ret = sem_wait(&g_rngdev.rd_readsem);
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
}
|
||||
|
||||
/* Done with the operation semaphore */
|
||||
|
||||
@ -303,7 +309,7 @@ static ssize_t stm32_rngread(struct file *filep, char *buffer, size_t buflen)
|
||||
|
||||
sem_post(&g_rngdev.rd_devsem);
|
||||
|
||||
return buflen;
|
||||
return ret < 0 ? ret : buflen;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user