From: kholk11@gmail.com
To: broonie@kernel.org
Cc: lgirdwood@gmail.com, agross@kernel.org,
bjorn.andersson@linaro.org, robh+dt@kernel.org,
kholk11@gmail.com, marijns95@gmail.com, konradybcio@gmail.com,
martin.botka1@gmail.com, linux-arm-msm@vger.kernel.org,
phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/7] regulator: core: Enlarge max OF property name length to 64 chars
Date: Sat, 26 Sep 2020 14:55:43 +0200 [thread overview]
Message-ID: <20200926125549.13191-2-kholk11@gmail.com> (raw)
In-Reply-To: <20200926125549.13191-1-kholk11@gmail.com>
From: AngeloGioacchino Del Regno <kholk11@gmail.com>
Some regulator drivers may be defining very long names: this is the
case with the qcom_smd and qcom_spmi regulators, where we need to
parse the regulator parents from DT.
For clarity, this is an example:
{ "l13a", QCOM_SMD_RPM_LDOA, 13, &pm660_ht_lvpldo,
"vdd_l8_l9_l10_l11_l12_l13_l14" },
pm660-regulators {
...
vdd_l8_l9_l10_l11_l12_l13_l14-supply = <&vreg_s4a_2p04>
...
};
Now, with a 32 characters limit, the function is trying to parse,
exactly, "vdd_l8_l9_l10_l11_l12_l13_l14-s" (32 chars) instead of
the right one, which is 37 chars long in this specific case.
... And this is not only the case with PM660/PM660L, but also with
PMA8084, PM8916, PM8950 and others that are not implemented yet.
The length of 64 chars was chosen based on the longest parsed property
name that I could find, which is in PM8916, and would be 53 characters
long.
At that point, rounding that to 64 looked like being the best idea.
Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
---
drivers/regulator/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7fed8cd134f8..d88bd846d866 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -409,11 +409,11 @@ static struct device_node *of_get_child_regulator(struct device_node *parent,
static struct device_node *of_get_regulator(struct device *dev, const char *supply)
{
struct device_node *regnode = NULL;
- char prop_name[32]; /* 32 is max size of property name */
+ char prop_name[64]; /* 64 is max size of property name */
dev_dbg(dev, "Looking up %s-supply from device tree\n", supply);
- snprintf(prop_name, 32, "%s-supply", supply);
+ snprintf(prop_name, 64, "%s-supply", supply);
regnode = of_parse_phandle(dev->of_node, prop_name, 0);
if (!regnode) {
--
2.28.0
next prev parent reply other threads:[~2020-09-26 12:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-26 12:55 [PATCH 0/5] Support for PM660/PM660L SPMI and SMD regulators kholk11
2020-09-26 12:55 ` kholk11 [this message]
2020-09-26 12:55 ` [PATCH 2/7] regulator: qcom_spmi: Add support for new regulator types kholk11
2020-09-26 12:55 ` [PATCH 3/7] regulator: qcom_spmi: Add PM660/PM660L regulators kholk11
2020-09-26 12:55 ` [PATCH 4/7] regulator: dt-bindings: Document the PM660/660L SPMI PMIC entries kholk11
2020-09-26 12:55 ` [PATCH 5/5] regulator: qcom_smd: Add PM660/PM660L regulator support kholk11
2020-09-26 12:55 ` [PATCH 6/7] mfd: qcom-spmi-pmic: Add support for PM660/PM660L kholk11
2020-11-04 11:07 ` Lee Jones
2020-09-26 12:55 ` [PATCH 7/7] regulator: dt-bindings: Document the PM660/PM660L PMICs entries kholk11
2020-10-01 17:01 ` [PATCH 0/5] Support for PM660/PM660L SPMI and SMD regulators Mark Brown
2020-10-01 22:47 ` Mark Brown
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=20200926125549.13191-2-kholk11@gmail.com \
--to=kholk11@gmail.com \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=broonie@kernel.org \
--cc=konradybcio@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijns95@gmail.com \
--cc=martin.botka1@gmail.com \
--cc=phone-devel@vger.kernel.org \
--cc=robh+dt@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