Gedare Bloom started a new discussion on cpukit/dhrl/dhrl.c: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1193#note_150841

 > +  }
 > +
 > +  /* Allocate internal context via malloc */
 > +  ctx = (struct rtems_dhrl_control *) malloc(
 > +    sizeof( struct rtems_dhrl_control )
 > +  );
 > +  if ( ctx == NULL ) {
 > +    return RTEMS_NO_MEMORY;
 > +  }
 > +
 > +  /* Initialize structure to prevent undefined behavior on failure checks */
 > +  ctx->worker_a_id = RTEMS_ID_NONE;
 > +  ctx->worker_b_id = RTEMS_ID_NONE;
 > +
 > +  /* Embed the context back into the user's config structure */
 > +  config->ctx = ctx;

Should you check that `config->ctx == NULL` and make that a requirement of the 
API? Just from a safety perspective, how do you check/prevent someone from 
calling `rtems_dhrl_init` twice?

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1193#note_150841
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to