Hi Steve,

On Fri, 2021-01-22 at 16:00 -0500, Steven Rostedt wrote:
> On Thu, 21 Jan 2021 11:01:05 -0600
> Tom Zanussi <zanu...@kernel.org> wrote:
> 
> > @@ -1208,13 +1173,14 @@ static int __create_synth_event(int argc,
> > const char *name, const char **argv)
> >      *      where 'field' = type field_name
> >      */
> >  
> > -   if (name[0] == '\0' || argc < 1) {
> > +   mutex_lock(&event_mutex);
> 
> I'm curious, why is the event_mutex taken here? I'm guessing it is
> first
> needed for the find_synth_event() call, in which case, it can be
> moved
> after the is_good_name() check. I don't see why the goto out is
> required
> here or for the is_good_name() check.
> 

Yes, it's for the find_synth_event() call, and yes, it should come
after the is_good_name() check.  I'll move it and fix up the goto
changes as a result.

Thanks,

Tom

> -- Steve
> 
> > +
> > +   if (name[0] == '\0') {
> >             synth_err(SYNTH_ERR_CMD_INCOMPLETE, 0);
> > -           return -EINVAL;
> > +           ret = -EINVAL;
> > +           goto out;
> >     }
> >  
> > -   mutex_lock(&event_mutex);
> > -
> >     if (!is_good_name(name)) {
> >             synth_err(SYNTH_ERR_BAD_NAME, errpos(name));
> >             ret = -EINVAL;

Reply via email to