From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 472E92DFA39; Mon, 3 Nov 2025 08:41:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762159265; cv=none; b=Xzci/zQUpadM5SsUiLcA3F4LWsRhldKRE46GlE/ohWgwtsgW2658msdMAULaa+QzYHNdRSWb/+iN3Z4KEE63mxjZFBFd6qdtsxiPS0tSBayUBv0g/rtrigUc8PuZwyx64Cm2cMgkoTibm8Ib/iGvu1dCsDnTQDfEenJcnSKZ0LI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762159265; c=relaxed/simple; bh=v+GhSFMVaW/Lfg8/fIiRNwYwGsUSOMGi1AXYxUkQrxU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Gfwqpo2DVlJpa7g2HsvCypuViUi1XJLls7OdP5Fc+8CJfeIfv0e6WJbDI18MEwcuiHkQtWTWGyP4GQELBAtrexlIkm4jjx4M5Q3M5hmIwUkdfXngh2EADTuOyqIErFQWqcwrFOSKASyF83fWL2h2vsvPqNXOklwCY5VJeucNeI0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=iWIQ6qIs; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="iWIQ6qIs" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 17B93C0D79F; Mon, 3 Nov 2025 08:40:33 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id C7E4F60628; Mon, 3 Nov 2025 08:40:53 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 23F7A11818002; Mon, 3 Nov 2025 09:40:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1762159252; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=OdBSKKFuFhKbNuvtZatqu6kaGrQLICACn7lyjwcUeMg=; b=iWIQ6qIsThvjONMtKyRFIt3RRi6l8dYaN4kZtEpF0WxdZTR7zGXHa3A3SoAxpgiYwhng1C zo2hxlhOeOIb85bpal78IjolPGrbtnhMf2GTaOtON4SFmj2JNEwTdhhikSLHT8y9Vdw5pv PGiWyZayoE1KrFgQsZhXz5nqIV76pBGQ8b8xJ76M3McS23COAjPQu2EtNEeGG/Y9zwpRNq g9l+LJDWDxoiA7qLF+F93yPnQWhTEwvv/B1gMSc6SWwqI7FSB0SrI3CR5JZdfOpIGSeo7I GXAnVbrl6Vm6a//OWA6mPtDG2QKiil4G6Ce/v9nokrQP0Y5ZxZU1SzYSk1dnMA== Date: Mon, 3 Nov 2025 09:40:45 +0100 From: Herve Codina To: Andy Shevchenko Cc: Wolfram Sang , Jonathan Cameron , David Lechner , Nuno =?UTF-8?B?U8Oh?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Pascal Eberhard , Miquel Raynal , Thomas Petazzoni Subject: Re: [PATCH v2 2/4] iio: adc: Add support for the Renesas RZ/N1 ADC Message-ID: <20251103094045.73a061ea@bootlin.com> In-Reply-To: References: <20251029144644.667561-1-herve.codina@bootlin.com> <20251029144644.667561-3-herve.codina@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.3.1 (GTK 3.24.43; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 Hi Andy, On Thu, 30 Oct 2025 11:00:12 +0200 Andy Shevchenko wrote: ... > > > + ret = devm_regulator_get_enable_optional(dev, avdd_name); > > + if (ret < 0) { > > + if (ret != -ENODEV) > > + return dev_err_probe(dev, ret, > > + "Failed to get '%s' regulator\n", > > + avdd_name); > > + return 0; > > + } > > if (ret == -ENODEV) > return dev_err_probe(); // takes less LoCs > if (ret < 0) // do we need ' < 0' part? > return 0; > Well, I need to abort on error returned by devm_regulator_get_enable_optional() but I need also to filter out the ENODEV error. ENODEV, returned by devm_regulator_get_enable_optional(), means that the regulator is not present. This should not be seen as an error by the caller. Indeed, the regulator is not present and so, the related ADC core will not be used. This is not an error from the caller perspective. The code you proposed is not correct regarding this point. Instead of my original code, I can propose the following: if (ret < 0) { if (ret == -ENODEV) return 0; return dev_err_probe(dev, ret, "Failed to get '%s' regulator\n", avdd_name); } What do you think about it? For other comments you have sent, I agree with them and I will take them into account in the next iteration. Best regards, Hervé