From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 65A2F3BE174 for ; Wed, 13 May 2026 21:34:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778708081; cv=none; b=uRKceFr/J/06fO+PUlIkn9W/IhbGG7yGld3klPLGL4Dhd4FICrSHcFSgHBFpR41mrzyLZBfkKQK8ukqOj4btt8k/6dlfxoftQAnZfmO6cJs9Cjz15RRT8wQa/x1gdjXl01dF9Ko3X/9aYSdOUe4ir7T5PLjZ6CrXhwtUwuFqXR4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778708081; c=relaxed/simple; bh=kZcChJqREVkQQHEf+Cv+4DLUKpU/qmqpFtGEeNeoxC8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SPI7RHF1f/j4+ZL2i553CbNQS5zOYFIjLUaDJkHvGi2GUj+onAT2w3pWhsilJRgBXIiXB4OJmmpQd4IsWmMD8SG1g16+omhPWTo03j+CNmgOvD7kP3jzeXmVZDgySDMgR4PIz3rPnCzmCo860utiF38+GEjRVE76bheOpo3A/lE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=I+vdAuaZ; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="I+vdAuaZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778708079; x=1810244079; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=kZcChJqREVkQQHEf+Cv+4DLUKpU/qmqpFtGEeNeoxC8=; b=I+vdAuaZZ+xz/K7ulpuQS9/uHf+fZrV9DmRJN2iovCL6HFahFIozpZNO AM1L4/VX/kHn2gKtQbot0/2//doLP51PUxl30ZvVokjqxaCfYHK6vvMwx u9CXBYOs94hqeDOYurhMqypmMfgh1/WY6arVi/DQ5Wc6oI9ZfJ46kxLe+ nXoJXpcewUP+cW6i/s/rrkNzwPnJu4oQtWzd90kHol3H4W9cJ7Pr9/PWU ypxEtxYyd5EYMm776L6Q0s3q+FakgqOEeZcyJn6oqXCNi9BLGkwrZ+aux HTHS/bXQnzqaZ8sGJ2OtEDTLngZV1WsqO9jADeTfzZJ5t9iHMRLLlRWU8 g==; X-CSE-ConnectionGUID: ZHRXxloOQ02xXDxjyJZliA== X-CSE-MsgGUID: n3DYqMmEQaS/X2liyyvkpA== X-IronPort-AV: E=McAfee;i="6800,10657,11785"; a="97072919" X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="97072919" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2026 14:34:39 -0700 X-CSE-ConnectionGUID: EhQxfke0QaawRfntB0aqog== X-CSE-MsgGUID: rwJD+o+LR4G92b/NypN8/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="233751257" Received: from slindbla-desk.ger.corp.intel.com (HELO localhost) ([10.245.244.106]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2026 14:34:34 -0700 Date: Thu, 14 May 2026 00:34:32 +0300 From: Andy Shevchenko To: Andre Przywara Cc: Sanjay Chitroda , Michal Piekos , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Maksim Kiselev , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support Message-ID: References: <20260513-sunxi-a523-gpadc-v2-0-d5efde151dac@mmpsystems.pl> <20260513-sunxi-a523-gpadc-v2-2-d5efde151dac@mmpsystems.pl> <4248ac7e-3cce-4db8-a2c1-710f2c903490@arm.com> <20260513231901.05dc9a82@ryzen.lan> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev 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: <20260513231901.05dc9a82@ryzen.lan> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo On Wed, May 13, 2026 at 11:19:01PM +0200, Andre Przywara wrote: > On Wed, 13 May 2026 23:12:05 +0300 > Andy Shevchenko wrote: > > On Wed, May 13, 2026 at 01:53:49PM +0200, Andre Przywara wrote: > > > On 5/13/26 13:44, Sanjay Chitroda wrote: > > > > On 13 May 2026 10:29:43 am IST, Michal Piekos wrote: ... > > > > > + if (ret <= 0) > > > > > > > > Thank you Michal for the change. > > > > > > > > Have you validated the changes ? > > > > It looks while success ret would be 0 and it would give return error. > > No, it doesn't. Returning 0 means no clocks found: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/clk-devres.c#n300 > > > Good catch! > > > > > But devm_clk_bulk_get_all_enabled() returns the number of clocks found and > > > enabled. And since we need at least one, I think this is correct, and the > > > error message below reflects that. > > > > > > To me that change looks good: > > > > > > Reviewed-by: Andre Przywara > > > > == 0 ??? > > Doesn't look like correct code. > > Not sure I follow: > devm_clk_bulk_get_all_enabled() returns the number of clocks in that > node, or a negative error value. If it returns 0, that means no clocks > have been found, Not in this code. Here it will be resent to the caller as success. > which is an error in our case, since we expect at > least one clock. This is what the second part of the error message > refers to. But not the error code itself! There will be no error message, IIRC the implementation of dev_err_probe(). > So we want one or two as the return value, with the current bindings, > but really anything greater than 0 is fine, from the driver's > perspective, since we don't care about the clocks beyond them being > enabled. > > So am I missing something? Yes! You returned that to the caller, meaning everything is fine. There is a success that is returned. The code is buggy (okay, not that, it rather will behave not as intended). TL;DR: You should have something like if (ret < 0) return dev_err_probe(ret); if (ret == 0) return dev_err_probe(-Exxx, "Needs at least one clock!\n"); -- With Best Regards, Andy Shevchenko