From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24ADC17745; Fri, 8 Mar 2024 21:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709932069; cv=none; b=j0fsm54fWHwaa48XPppnVIKN8sKairzJt/mQ2HByoDgePj+sQ/GaStbgPmwgM1V5PqTrxZPfmDUga7bUP+vnFz2fn2ld6Ac9XSeK9Av1fvjWBTsb7jbsVmiJCcVbEbbvWjN4jyP4wGry06Xji0skvHlp6hr1OhWnKPQIjLSeGpg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709932069; c=relaxed/simple; bh=Rafts2ktybCYCpYRua0CGo5JhyQRssPbKtGgM7c4hs8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Dm4p98aQIKYoUdfzDOHKGiyRUaS/eZlc+91a9LNocEBWgvfbwW1OxrH/aOWiXjb8c+968WxOMjW1RFCciKpyKKS83RsUyH1Xn69WHYiqLzNmkHjsEyg2/gCKABN42x6r8yJFOO/aucpajDmuY1BK10N+zj2xrXKd5EIwX1m0INA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eT3Uqn1V; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eT3Uqn1V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56CADC43390; Fri, 8 Mar 2024 21:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709932068; bh=Rafts2ktybCYCpYRua0CGo5JhyQRssPbKtGgM7c4hs8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eT3Uqn1VjwoaFOvgzuD3hNka8x/blswH1Zz7/dmxoAU1T2rEZLdmF0Zv8druvgf8C dChAIdgK0a0y37ONSQgy/VadgUVkO68TCstLJA4zgxc5HRUXnj4410JlphPLQuEXoG temNOYJbPuc4E+n9EM4TC2fntUtFfjf8Gdh4fhbwMzeb0fQR4dm1F4MKlZKSLRbhOv E3NzCRjZjooefTy5/fuvJR5jfMsa6/pOXdjrK/88fVyCnyZanb9AeMyT+biXVMLna3 UiiqePWQ3hx7ag1v9xNPJP7Prjwss47rthQdUFBMqXJcTsUGuhv+uUmz897Tdcs1vU XFT2fz87XHMvw== Date: Fri, 8 Mar 2024 21:07:45 +0000 From: Simon Horman To: Kory Maincent Cc: Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Richard Cochran Subject: Re: [PATCH net-next] ptp: Move from simple ida to xarray Message-ID: <20240308210745.GE603911@kernel.org> References: <20240307100327.887758-1-kory.maincent@bootlin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240307100327.887758-1-kory.maincent@bootlin.com> On Thu, Mar 07, 2024 at 11:03:26AM +0100, Kory Maincent wrote: > Move from simple ida to xarray for storing and loading the ptp_clock > pointer. This prepares support for future hardware timestamp selection by > being able to link the ptp clock index to its pointer. > > Signed-off-by: Kory Maincent ... > @@ -246,11 +246,10 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, > if (ptp == NULL) > goto no_memory; > > - index = ida_alloc_max(&ptp_clocks_map, MINORMASK, GFP_KERNEL); > - if (index < 0) { > - err = index; > + err = xa_alloc(&ptp_clocks_map, &index, ptp, xa_limit_31b, > + GFP_KERNEL); > + if (err) > goto no_slot; > - } > > ptp->clock.ops = ptp_clock_ops; > ptp->info = info; Hi Kory, Prior to this change err was -ENOMEM at this point. Now it is 0. And The immediately following code is: ptp->devid = MKDEV(major, index); ptp->index = index; INIT_LIST_HEAD(&ptp->tsevqs); queue = kzalloc(sizeof(*queue), GFP_KERNEL); if (!queue) goto no_memory_queue; The goto above results in: return ERR_PTR(err); But here err is 0. This does not seem correct. Flagged by Smatch. ... -- pw-bot: changes-requested