Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp706413pxj; Tue, 18 May 2021 12:16:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIJeSQZmiM7FdP/anv8ocdEbS4Zw9YrTdb4LIvEJgDqblsYlSlCFgukBSYZ5ESlgwxHxa3 X-Received: by 2002:a05:6e02:ee9:: with SMTP id j9mr5968239ilk.14.1621365409874; Tue, 18 May 2021 12:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621365409; cv=none; d=google.com; s=arc-20160816; b=cz5TyiIm7tSpYbCS+FP0JH/VETZNrHLg11X7eHtNGr9dAdEaxrKcO3tti2TstFeNKb OuFPh0EtdXMfpC6LIoiF457c+dAA8+hetl48DJupdkwNy6Vw4qRSY3V0j8+rqlk/pGBd mXmsABaPI2PxbrleXvfB5TjOV/jlEOzsjKERxIJddULgJeSHC7oofIi7lxYAsJ/2HUrn 2zozkW5+u6m22z4MdhEdb9/6gucZquxDK0/k58wph2wts6p8ccfEkHBLu31sTuhciZ3+ x852z+KWwonHYUPEyM+uaege0iUK0dF90tzT6kT9Cx555zuZsJUTP4ZG+nZgNc7MS7LJ pFiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kdeSQM6n6ehpxt42Ss8k8UZyemLNVXlBn2/V/96APY4=; b=f7BQFCTbydMaV4EYQzHD2koFTZ+rmY/GRavQviOBuXPn8DiqCtn5tsIIlwd0YzPmtO tNqgC/J9fY9JFr7VfvwIGTwZVYUfW2EuWdDw7LyoulpanTeTm68czBlqE2FCFyJkGWBG WKx735O9NOfphJ3v38Bzrv9+F5eep+hn8RVxvsv2P9rHFKr+Kb4Fr97G6kHvqXqVHrTD 9pa26L5QBphenOSRu1Og33eemAPZaMNZkuM3p8VN2+05a9Pklih96buDUtzJlfzOGjvb G4x4kUODO3WPj5AT80ff1XBM57la96ukcd5rRYmx9LszQWlxkyNVD8V8/+zPYL70YSEM 3L4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WVotFD6K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v17si6904340jan.123.2021.05.18.12.16.23; Tue, 18 May 2021 12:16:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WVotFD6K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244075AbhEQQSG (ORCPT + 99 others); Mon, 17 May 2021 12:18:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346057AbhEQQO6 (ORCPT ); Mon, 17 May 2021 12:14:58 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3079FC035437 for ; Mon, 17 May 2021 07:48:17 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id v11-20020a17090a6b0bb029015cba7c6bdeso3864345pjj.0 for ; Mon, 17 May 2021 07:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kdeSQM6n6ehpxt42Ss8k8UZyemLNVXlBn2/V/96APY4=; b=WVotFD6KFq7FKYZUVMZr4WZBVObM0/yy+5GOpB78HbjC+HRel8qTTi23kLZAFV5YpL 8Le7N3FuVQ++shWQdW8GQFDeZy85GynYsH5DUnnyBHc4mk9j1A4sWUafeEY26uFvrHKE ZI6U7h4WaKiXvtCQws6l8+G1QBHV3UUBdgKj2kADT/H6BiLEOM3fXeBb/z7Yl5PUUC36 RNHtkC3sU8VBTLkx1mfiYpMKMcV9t+tvhILPiqJi68boLB6IoHTJ+GkkYTuj4rcA8aRQ XWSPY0qYpBoWeVZyM4aI+EB/uyfIArlZogL1IgyzD42ocD6yc/vN5x+Eimyr0cDn9bBT yDOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kdeSQM6n6ehpxt42Ss8k8UZyemLNVXlBn2/V/96APY4=; b=i4poTlXO4auoTDBiqYyOovWv+KhQofZLl6mrRBlxfVaejc1+KAweLLd2vesbLEThhN zhq7evlzVYRSmttYBpviqnep7pZP+8C4xyQ1hF3kzLMofXKhfEgtCnPxeVwMyQ96BfNC AHgqh0AYJH/Dt4okfC88KzlsR587PMFH1MLD/M8XXbSPn//sa6QmQaZZBPm62AFMmksi HeF/KcnFy+zYB4MT7aRZm5V/3CQ8YQ03C+LPosVaeyYJ1O1dtlUrS56XP/a7bKjMvuVJ ptdVMpaBmrl1ls5hM7NQNGl5bO1KjUBXGveLnz67N8yLtrjblj8W8i5/vj4HMau5OLJ6 E71w== X-Gm-Message-State: AOAM530jm2opeWPn3UZy46BWo7RmDCd6BRllkG1aQCwbfl1FcokpekXH 9rg3Ap14L2VhjECzKxMheQE= X-Received: by 2002:a17:90a:a2b:: with SMTP id o40mr302170pjo.214.1621262896743; Mon, 17 May 2021 07:48:16 -0700 (PDT) Received: from hyeyoo ([183.99.11.150]) by smtp.gmail.com with ESMTPSA id h1sm10449494pfh.72.2021.05.17.07.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 07:48:16 -0700 (PDT) Date: Mon, 17 May 2021 23:48:11 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Takashi Iwai Cc: Jaroslav Kysela , Takashi Iwai , Greg Kroah-Hartman , Oliver Neukum , Vasily Khoruzhick , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] sound: line6: Fix race condition in line6_probe Message-ID: <20210517144811.GA54892@hyeyoo> References: <20210517132725.GA50495@hyeyoo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 17, 2021 at 03:43:24PM +0200, Takashi Iwai wrote: > The actually needed initialization is > line6_init_mid() call, and this can be fixed by moving to the > appropriate place instead of inside each private_init callback. Oh, I missed it! there was another caller of line6_init_midi. your fix seems promising to me. it's putting line6_init_midi to the right place. by the way looking at code, I think this driver needs some refactoring... it doesn't handle exceptions well. Thanks, Hyeonggon > --- > diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c > index a030dd65eb28..9602929b7de9 100644 > --- a/sound/usb/line6/driver.c > +++ b/sound/usb/line6/driver.c > @@ -699,6 +699,10 @@ static int line6_init_cap_control(struct usb_line6 *line6) > line6->buffer_message = kmalloc(LINE6_MIDI_MESSAGE_MAXLEN, GFP_KERNEL); > if (!line6->buffer_message) > return -ENOMEM; > + > + ret = line6_init_midi(line6); > + if (ret < 0) > + return ret; > } else { > ret = line6_hwdep_init(line6); > if (ret < 0) > diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c > index cd44cb5f1310..16e644330c4d 100644 > --- a/sound/usb/line6/pod.c > +++ b/sound/usb/line6/pod.c > @@ -376,11 +376,6 @@ static int pod_init(struct usb_line6 *line6, > if (err < 0) > return err; > > - /* initialize MIDI subsystem: */ > - err = line6_init_midi(line6); > - if (err < 0) > - return err; > - > /* initialize PCM subsystem: */ > err = line6_init_pcm(line6, &pod_pcm_properties); > if (err < 0) > diff --git a/sound/usb/line6/variax.c b/sound/usb/line6/variax.c > index ed158f04de80..1376fc405c7f 100644 > --- a/sound/usb/line6/variax.c > +++ b/sound/usb/line6/variax.c > @@ -172,11 +172,6 @@ static int variax_init(struct usb_line6 *line6, > if (variax->buffer_activate == NULL) > return -ENOMEM; > > - /* initialize MIDI subsystem: */ > - err = line6_init_midi(&variax->line6); > - if (err < 0) > - return err; > - > /* initiate startup procedure: */ > schedule_delayed_work(&line6->startup_work, > msecs_to_jiffies(VARIAX_STARTUP_DELAY1));