From b4270a93c7a58cc7a4281dcf3d977f046b165dd7 Mon Sep 17 00:00:00 2001 From: David Collins Date: Tue, 7 Feb 2017 17:44:31 -0800 Subject: [PATCH] ANDROID: GKI: regulator: core: allow long device tree supply regulator property names The length 32 buffer in of_get_regulator() limits the maximum possible supply name to 24 characters (32 - 1 [null terminator] - 7 [strlen("-supply")]). This causes problems for device nodes with longer supply property names. Increase the size of the buffer to remove this artificial restriction. Bug: 150508586 Change-Id: Ic28ee290dcd7411ba8325a2b42c12173958a11d8 Signed-off-by: David Collins (cherry picked from commit f6d207a3235617a4acffb246f3817c32bd30ee39) Signed-off-by: Saravana Kannan --- 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 17966a1f7732..15a9f9eba773 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -270,11 +270,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[256]; dev_dbg(dev, "Looking up %s-supply from device tree\n", supply); - snprintf(prop_name, 32, "%s-supply", supply); + snprintf(prop_name, sizeof(prop_name), "%s-supply", supply); regnode = of_parse_phandle(dev->of_node, prop_name, 0); if (!regnode) {