binfmt/nxflat.c: Trivial design simplification.

This commit is contained in:
Gregory Nutt 2019-03-12 10:09:03 -06:00
parent 622202da20
commit 82b276a34c
2 changed files with 19 additions and 22 deletions

View File

@ -2675,11 +2675,11 @@ static int stm32_addmac(struct net_driver_s *dev, const uint8_t *mac)
registeraddress = STM32_ETH_MACHTLR;
}
temp = stm32_getreg(registeraddress);
temp = stm32_getreg(registeraddress);
temp |= 1 << hashindex;
stm32_putreg(temp, registeraddress);
temp = stm32_getreg(STM32_ETH_MACFFR);
temp = stm32_getreg(STM32_ETH_MACFFR);
temp |= (ETH_MACFFR_HM | ETH_MACFFR_HPF);
stm32_putreg(temp, STM32_ETH_MACFFR);

View File

@ -244,28 +244,25 @@ static int nxflat_unloadbinary(FAR struct binary_s *binp)
{
FAR struct dspace_s *dspace = (FAR struct dspace_s *)binp->alloc[0];
if (dspace != NULL)
/* Check if this is the last reference to dspace. It may still be needed
* by other threads. In that case, it must persist after this thread
* terminates.
*/
if (dspace != NULL && dspace->crefs == 1)
{
/* Check if this is the last reference to dspace. It may still be
* needed by other threads. In that case, it must persist after this
* thread terminates.
/* Free the dspace region */
kumm_free(dspace->region);
dspace->region = NULL;
/* Mark alloc[0] (dspace) as freed */
binp->alloc[0] = NULL;
/* The reference count will be decremented to zero and the dspace
* container will be freed in sched/sched_releasetcb.c
*/
if (dspace->crefs == 1)
{
/* Free the dspace region */
kumm_free(dspace->region);
dspace->region = NULL;
/* Mark alloc[0] (dspace) as freed */
binp->alloc[0] = NULL;
/* The reference count will be decremented to zero and the dspace
* container will be freed in sched/sched_releasetcb.c
*/
}
}
return OK;