From: Johan Hovold <johan@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] gnss: ubx: Use devm_regulator_get_enable_optional()
Date: Tue, 20 Jun 2023 10:59:06 +0200 [thread overview]
Message-ID: <ZJFqWuKgoQfH7PMP@hovoldconsulting.com> (raw)
In-Reply-To: <c398861197e9d5e28fa2420089abd9c3adb61a87.1686996063.git.christophe.jaillet@wanadoo.fr>
On Sat, Jun 17, 2023 at 12:01:22PM +0200, Christophe JAILLET wrote:
> Use devm_regulator_get_enable_optional() instead of hand writing it. It
> saves some line of code.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> - data->v_bckp = devm_regulator_get_optional(&serdev->dev, "v-bckp");
> - if (IS_ERR(data->v_bckp)) {
> - ret = PTR_ERR(data->v_bckp);
> - if (ret == -ENODEV)
> - data->v_bckp = NULL;
> - else
> - goto err_free_gserial;
> - }
> -
> - if (data->v_bckp) {
> - ret = regulator_enable(data->v_bckp);
> - if (ret)
> - goto err_free_gserial;
> - }
> + ret = devm_regulator_get_enable_optional(&serdev->dev, "v-bckp");
> + if (ret)
> + goto err_free_gserial;
Same here, this breaks the driver as -ENODEV is returned when the
optional resource is not present.
Johan
prev parent reply other threads:[~2023-06-20 8:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-17 10:01 Christophe JAILLET
2023-06-20 8:59 ` Johan Hovold [this message]
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=ZJFqWuKgoQfH7PMP@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=broonie@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®