linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Weiss <luca.weiss@fairphone.com>
To: linux-iio@vger.kernel.org
Cc: ~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org,
	Luca Weiss <luca.weiss@fairphone.com>,
	Song Qiang <songqiang1304521@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Markuss Broks <markuss.broks@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] proximity: vl53l0x: Make VDD regulator actually optional
Date: Tue, 14 Jun 2022 13:20:50 +0200	[thread overview]
Message-ID: <20220614112049.302278-1-luca.weiss@fairphone.com> (raw)

Contrary to what the naming might suggest, devm_regulator_get_optional
returns -ENODEV in case the regulator is not found which will trigger
probe error in this driver.

Use devm_regulator_get instead which will return a dummy regulator that
we can just use as if it was a proper regulator.

Fixes: d3d6dba56dab ("proximity: vl53l0x: Handle the VDD regulator")
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
@Jonathan: As discussed in the other email, maybe you want to
adjust/remove the "Fixes:" tag. Your call.

 drivers/iio/proximity/vl53l0x-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c
index 3b7a33ff601d..c7c4d33d340f 100644
--- a/drivers/iio/proximity/vl53l0x-i2c.c
+++ b/drivers/iio/proximity/vl53l0x-i2c.c
@@ -237,7 +237,7 @@ static int vl53l0x_probe(struct i2c_client *client)
 				     I2C_FUNC_SMBUS_BYTE_DATA))
 		return -EOPNOTSUPP;
 
-	data->vdd_supply = devm_regulator_get_optional(&client->dev, "vdd");
+	data->vdd_supply = devm_regulator_get(&client->dev, "vdd");
 	if (IS_ERR(data->vdd_supply))
 		return dev_err_probe(&client->dev, PTR_ERR(data->vdd_supply),
 				     "Unable to get VDD regulator\n");
-- 
2.36.1


             reply	other threads:[~2022-06-14 11:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 11:20 Luca Weiss [this message]
2022-06-18 16:55 ` [PATCH] proximity: vl53l0x: Make VDD regulator actually optional Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220614112049.302278-1-luca.weiss@fairphone.com \
    --to=luca.weiss@fairphone.com \
    --cc=broonie@kernel.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markuss.broks@gmail.com \
    --cc=phone-devel@vger.kernel.org \
    --cc=songqiang1304521@gmail.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).