From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 580D51CEAA3 for ; Thu, 8 Jan 2026 00:42:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767832965; cv=none; b=AcIYXAtdQoGirbNOloufigrDiyhgMPfD0EKm6rzB09D7efwaHfLCecIXMhlDz28maGSBGe56on4ExpmCb1wAZ1+DkqNv+bW3thgSitsCNtg52gCuZYloBoEK2b5xhwVlQ6jkUe49eoSXrVjDq3BrP3PjgcEoxHvyqaDB8ubbtOM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767832965; c=relaxed/simple; bh=9r88JtSZ6xGnZCA8BUjHISgxh3ySwofk73N/9vkt6PQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ojMrrVFam54aVEnmYcM9rWedcrlQBVHYUHTQqlncTy23opiDCeixAYB7sDYICUVRsN5dgFxrLb82fvkLWgoBG1d2id7gs4fVtcmfIT+cEoCC63nWaxJI4ec+yakJgea0pRyKeNCv75zervYJkVGJ2+JaJdq3eCL3WrktoSILjeQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NRPfGZK0; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NRPfGZK0" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-42fed090e5fso1385098f8f.1 for ; Wed, 07 Jan 2026 16:42:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767832961; x=1768437761; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=P/9BEHPko6/406fwIeYINmqT5OrYPin1DACgb6PeivA=; b=NRPfGZK0K7QuvYHnmcGT/v1cOr8XWLfMZ8BDcUhIuPWOez5LW9C3727+u3bWKJSuAM x0xFEUmLEQHpe9VssMLVNzpDJaIReiZHYBoCCYP0eDsXT3oCedokbXezLK6+A0S1cA0T W4pJiCaZXH6P8pHX5SdEd4RGc3lf02f4wXsGPgMEu8lUKP2U8Y1yYwqmmaGx5QJfjl1O dG3zY8Z4p01ip2x5qMxxTwSV4DwMlWaQCd9ceg4mYTFPA+gXx9DdXMdNfc+ia1mA6hVk eW3UydxdEpRtAFaf+1g0HbqYGQ0gKMDMin8+HZkaBBQAonm51DBPGlN0QkmKn82gwirj ncWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767832961; x=1768437761; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=P/9BEHPko6/406fwIeYINmqT5OrYPin1DACgb6PeivA=; b=kHP7yd63I2ddHOQ6fdU0Tznby+CDOUE8YfupgnTnF079nW0vqWDMEENA8F1fJfy5oY Q4HZzg8HkQlBJMfOO+jerAk1xjX5CNWBbY2IpawHi4QoA1xcWwhwFmsmJuzvtN1uc0cn Rjnuq3m4D8ChFC/FD5BLt/+BngimDVbp4yXaElG1H4FJinCo28pr87XsJXhimtT8F6f4 yUm2Bsm2F7ArhpqDRnoKTeUVwldUa+dK/kwIwIa+fTysMzHcsB9kRpl/ggOwXQUPROPc qcYnh6nkYo0Kc6EeqW/JXwei7yY0ROmvinyiXELdYQ8EAQyP0ST9sXDLuFUmdLyxirwl 5tow== X-Forwarded-Encrypted: i=1; AJvYcCWtY/XAITieV9PZdyQlmWeiz/w9F6cf+iSC2E6yfIOEFDmUw3VB1fMD5eEbbA7r02bfDLg6K/VH7x04L3w=@vger.kernel.org X-Gm-Message-State: AOJu0YySx1DIl+RERrzuSpFaR7FoqG2mS/b4yGh3h7FaueVNHsuDg1ut 8rEgmdUpcQYSIbR0FWCyChrHCj8lv+piQ7fZZ7HP18gglmkCZrFWKU6e X-Gm-Gg: AY/fxX7+HvTvDwHol8J2hoo52Rd2aaYpuDR/X2Cf/PVPfABsvSk635oTQEssOQnsYFi kPGTOMVGhWQRmUrGifNOHEolG7AFs2CQ+U8tV0kfliJj8rRvByJtN7VhMfCgrjGEHvc29HSZ3Uz 6U3wdJ+0596WnnMrPEoz6jkCNGXRu4Nln9rVZrUvQHkQHtCtwfHySqjVdJqOKB4mqAB3/kIGTr1 EUhNOAALa+/Kg3dhqjxzK4gyiPPJutU/nUTaFPQEOqSbT6WompNh0eWskuBU4rtgRb/LOWQcfqQ pfmlyWaadHbyX3MupRkMnbPvhWigZXliHSBj18tQbLHOAX6T1bOqtn1U3jMknP++5Izb4VboJwB nbM/1foFDvSd34yAm2/uy2jNK1a1xVdKVnUbIkvfjVyLTRWXh/WgxzjzkvnB7sMfoFYRbhswOeI WuVEHzJ7ot/NKvvg== X-Google-Smtp-Source: AGHT+IFTfQWgJn/mwY43/DpenxZMUgLIDYN3NOa3kiGMyzLgOoMz9GLFCupyFA0R0Z3yX3Mz7Ira5A== X-Received: by 2002:a05:6000:1843:b0:432:b951:e9ff with SMTP id ffacd0b85a97d-432c376158amr6238838f8f.53.1767832961411; Wed, 07 Jan 2026 16:42:41 -0800 (PST) Received: from [192.168.0.2] ([212.50.121.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5ee5eesm13342959f8f.34.2026.01.07.16.42.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Jan 2026 16:42:40 -0800 (PST) Message-ID: Date: Thu, 8 Jan 2026 02:42:54 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [net-next v4 2/8] net: wwan: core: split port creation and registration To: Slark Xiao , Sai Krishna Gajula Cc: "loic.poulain@oss.qualcomm.com" , "johannes@sipsolutions.net" , "andrew+netdev@lunn.ch" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "mani@kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20260105102018.62731-1-slark_xiao@163.com> <20260105102018.62731-3-slark_xiao@163.com> <65a926ef.5e4a.19b97551cdb.Coremail.slark_xiao@163.com> Content-Language: en-US From: Sergey Ryazanov In-Reply-To: <65a926ef.5e4a.19b97551cdb.Coremail.slark_xiao@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/7/26 09:21, Slark Xiao wrote: > At 2026-01-07 00:49:50, "Sai Krishna Gajula" wrote: >>> -----Original Message----- >>> From: Slark Xiao >>> Sent: Monday, January 5, 2026 3:50 PM >>> To: loic.poulain@oss.qualcomm.com; ryazanov.s.a@gmail.com; >>> johannes@sipsolutions.net; andrew+netdev@lunn.ch; >>> davem@davemloft.net; edumazet@google.com; kuba@kernel.org; >>> pabeni@redhat.com; mani@kernel.org >>> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org >>> Subject: [net-next v4 2/8] net: wwan: core: split port creation and >>> registration >>> >>> From: Sergey Ryazanov Upcoming GNSS (NMEA) >>> port type support requires exporting it via the GNSS subsystem. On another >>> hand, we still need to do basic WWAN core work: find or allocate the WWAN >>> device, make it the >>> From: Sergey Ryazanov >>> >>> Upcoming GNSS (NMEA) port type support requires exporting it via the GNSS >>> subsystem. On another hand, we still need to do basic WWAN core >>> work: find or allocate the WWAN device, make it the port parent, etc. To reuse >>> as much code as possible, split the port creation function into the registration >>> of a regular WWAN port device, and basic port struct initialization. >>> >>> To be able to use put_device() uniformly, break the device_register() call into >>> device_initialize() and device_add() and call device initialization earlier. [skipped] >>> + struct wwan_device *wwandev = to_wwan_dev(port->dev.parent); >>> + char namefmt[0x20]; >>> + int minor, err; >>> + >>> + /* A port is exposed as character device, get a minor */ >>> + minor = ida_alloc_range(&minors, 0, WWAN_MAX_MINORS - 1, >>> GFP_KERNEL); >>> + if (minor < 0) >>> + return minor; >>> + >>> + port->dev.class = &wwan_class; >>> + port->dev.devt = MKDEV(wwan_major, minor); >>> + >>> + /* allocate unique name based on wwan device id, port type and >>> number */ >>> + snprintf(namefmt, sizeof(namefmt), "wwan%u%s%%d", wwandev- >>>> id, >>> + wwan_port_types[port->type].devsuf); >>> + >>> + /* Serialize ports registration */ >>> + mutex_lock(&wwan_register_lock); >>> + >>> + __wwan_port_dev_assign_name(port, namefmt); >>> + err = device_add(&port->dev); >>> + >>> + mutex_unlock(&wwan_register_lock); >>> + >>> + if (err) >>> + return err; >> Please check, if freeing with ida_free is required before returning err. >> if (err) { >> ida_free(&minors, minor); >> return err; >> } > Yes, you are right. > And patch 7/8 modifies this file as well. We need to align with that changes > since there are some issues(we still allocates the minor even the cdev is > false). This would lead to the release function can't release the correct > devt. Sai, nice catch! It should free the minor number on error exactly like this. -- Sergey