From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 067D55D8FC; Tue, 6 Feb 2024 12:30:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707222626; cv=none; b=HVXRFK7fAdxjp2ISt5XoEVWk5ZMV8+OAc/3+R9I0BYw6YuIz0D5+l38wuzD/08iph2r/P4q5viwyixL3aBE5w8lQ8Foru0T6OJe5HfAVj2qIGOCoRfv5gcOhFCiC67/apG/gSp63eSg9U/QFsb+N+zwAk0Oh7RNWQ1wIxOpkVMU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707222626; c=relaxed/simple; bh=hTgkI8aNc7DauvgizYJN2eynljPZb4ZGr+yoeugS+cE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Qb2Fg8A8I+86Oj1w0TDVa4eh0N73FX0Jo9VyX3r+GhMebD0lQswgNawimt/dIqaD84bcpfbQAibFqruPGm8ef+NWNlCCqPMLb+LNo+fHNpwiXesaw0KMoSrilBNxxnaTm7rhawRAYzx3kwx4zjiVe7K927v0/vMv9fCx6J+5twE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BmFbcJeD; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BmFbcJeD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707222625; x=1738758625; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=hTgkI8aNc7DauvgizYJN2eynljPZb4ZGr+yoeugS+cE=; b=BmFbcJeDhcFMyCSzMCzqcIi5TAjTzpxsUKMWs+iVQjmVQd+1U5bWMxDl YptKvM4gIUYNWRR3S7MP7hoV58MMl24bqHOoV1KiCvtHhBYoMXYJtsC/s NPCIFkxrwQHphVVsSbBB6vTAgknwo6OzBNmWAvqkY25BknMEmYT2vVuVI soJcoGw2aQXu6QNPmEa+4weJgGAQKnRV+E0KXskLtzQEOEVaHVfj7GLHp t4ejzqnCanBrqWv9zYTwOKogaz/zDLD551yzfRvGDhtpy2z/xZT1PhTOY z2LQ9JYOrSqsELUGU91mdBGNnrgO1FDbd4ss0G9cb+x94kyQhcedHGS0z Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10975"; a="18253494" X-IronPort-AV: E=Sophos;i="6.05,247,1701158400"; d="scan'208";a="18253494" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2024 04:30:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10975"; a="909626381" X-IronPort-AV: E=Sophos;i="6.05,247,1701158400"; d="scan'208";a="909626381" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2024 04:30:21 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rXKag-00000002Kx3-3c7b; Tue, 06 Feb 2024 14:30:18 +0200 Date: Tue, 6 Feb 2024 14:30:18 +0200 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Linus Walleij , Kent Gibson , Alex Elder , Geert Uytterhoeven , "Paul E . McKenney" , Wolfram Sang , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v2 17/23] gpio: reduce the functionality of validate_desc() Message-ID: References: <20240205093418.39755-1-brgl@bgdev.pl> <20240205093418.39755-18-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Mon, Feb 05, 2024 at 08:22:23PM +0100, Bartosz Golaszewski wrote: > On Mon, Feb 5, 2024 at 2:47 PM Andy Shevchenko > wrote: > > On Mon, Feb 05, 2024 at 10:34:12AM +0100, Bartosz Golaszewski wrote: ... > > > void gpiod_free(struct gpio_desc *desc) > > > { > > > - /* > > > - * We must not use VALIDATE_DESC_VOID() as the underlying gdev->chip > > > - * may already be NULL but we still want to put the references. > > > - */ > > > - if (!desc) > > > - return; > > > + VALIDATE_DESC_VOID(desc); > > > > IIRC we (used to) have two cases like this (you added one in some code like > > last year). > > > > None of the consumer-facing functions does it anymore. Not sure about > this, maybe it was removed earlier. Okay, the only place that might be considered is gpiod_to_gpio_device(). But that API seems new, I don't know if VALIDATE_DESC_VOID() is okay to use there, maybe it should be commented if not. Also there is a typo in the kernel doc — 'the users already holds' --> 'the user already holds'. -- With Best Regards, Andy Shevchenko