Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp835174lqc; Fri, 8 Mar 2024 13:07:58 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXNbbRPFfgyF0t89U8dwzhfZbE9hS9CrwPgcktvVpg1EaWtm8m3Zv5Cg4y0TFYqdu8TbUyjSDbp/Pw4zTxFbK+kGDNLP4Xr2+7T4lyMbw== X-Google-Smtp-Source: AGHT+IH+5P5eSYrQbXm/nKn7DgUA8Ndrt7soTz2mSeW0a2t4CJjtrNpUmxe/wXmVbSUqQI8vhMbh X-Received: by 2002:ad4:44b4:0:b0:690:b543:8a52 with SMTP id n20-20020ad444b4000000b00690b5438a52mr339256qvt.28.1709932078604; Fri, 08 Mar 2024 13:07:58 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id oo25-20020a056214451900b0068fc2ac7f59si277387qvb.462.2024.03.08.13.07.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 13:07:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97592-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=eT3Uqn1V; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-97592-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97592-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4EE261C21876 for ; Fri, 8 Mar 2024 21:07:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03A8D5F84E; Fri, 8 Mar 2024 21:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eT3Uqn1V" 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 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: linux-kernel@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