mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
binfmt/nxflat.c: Trivial design simplification.
This commit is contained in:
@@ -2675,11 +2675,11 @@ static int stm32_addmac(struct net_driver_s *dev, const uint8_t *mac)
|
|||||||
registeraddress = STM32_ETH_MACHTLR;
|
registeraddress = STM32_ETH_MACHTLR;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = stm32_getreg(registeraddress);
|
temp = stm32_getreg(registeraddress);
|
||||||
temp |= 1 << hashindex;
|
temp |= 1 << hashindex;
|
||||||
stm32_putreg(temp, registeraddress);
|
stm32_putreg(temp, registeraddress);
|
||||||
|
|
||||||
temp = stm32_getreg(STM32_ETH_MACFFR);
|
temp = stm32_getreg(STM32_ETH_MACFFR);
|
||||||
temp |= (ETH_MACFFR_HM | ETH_MACFFR_HPF);
|
temp |= (ETH_MACFFR_HM | ETH_MACFFR_HPF);
|
||||||
stm32_putreg(temp, STM32_ETH_MACFFR);
|
stm32_putreg(temp, STM32_ETH_MACFFR);
|
||||||
|
|
||||||
|
|||||||
+17
-20
@@ -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];
|
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
|
/* Free the dspace region */
|
||||||
* needed by other threads. In that case, it must persist after this
|
|
||||||
* thread terminates.
|
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;
|
return OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user