On Sat, 2018-08-18 at 00:11 -0400, Richard Cochran wrote: > On Thu, Aug 16, 2018 at 10:42:14AM -0700, Vedang Patel wrote: > > > > > +static int check_source_identity(struct port *p, struct > > ptp_message *m) > > +{ > > + struct PortIdentity master; > > + > > + if (!p->ignore_source_id) { > > + master = clock_parent_identity(p->clock); > > + if (!pid_eq(&master, &m- > > >header.sourcePortIdentity)) { > > + return -1; > > + } > > + } > > + return 0; > > +} > I prefer an "early out" pattern, like: > > if (p->ignore_source_id) { > return 0; > } > master = clock_parent_identity(p->clock); > if (!pid_eq(&master, &m->header.sourcePortIdentity)) { > return -1; > } > return 0; > > or even: > > if (p->ignore_source_id) { > return 0; > } > master = clock_parent_identity(p->clock); > return pid_eq(&master, &m->header.sourcePortIdentity) ? 0 : -1; > Will include the second version in v3.
Thanks, Vedang > Thanks, > Richard > > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel