Skip to content

Commit

Permalink
binfmt/nxflat.c: Trivial design simplification.
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-nutt committed Mar 12, 2019
1 parent 622202d commit 82b276a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
4 changes: 2 additions & 2 deletions arch/arm/src/stm32f7/stm32_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
31 changes: 14 additions & 17 deletions binfmt/nxflat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
/* 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->crefs == 1)
{
/* Free the dspace region */
if (dspace != NULL && dspace->crefs == 1)
{
/* Free the dspace region */

kumm_free(dspace->region);
dspace->region = NULL;
kumm_free(dspace->region);
dspace->region = NULL;

/* Mark alloc[0] (dspace) as freed */
/* Mark alloc[0] (dspace) as freed */

binp->alloc[0] = NULL;
binp->alloc[0] = NULL;

/* The reference count will be decremented to zero and the dspace
* container will be freed in sched/sched_releasetcb.c
*/
}
/* The reference count will be decremented to zero and the dspace
* container will be freed in sched/sched_releasetcb.c
*/
}

return OK;
Expand Down

0 comments on commit 82b276a

Please sign in to comment.