Skip to content

Commit

Permalink
regulator: s2mpa01: reduce stack size for probe function
Browse files Browse the repository at this point in the history
In some rare configurations we can run into rather high kernel stack
consumption:

drivers/regulator/s2mpa01.c:397:1: error: the frame size of 1536 bytes is larger than 1152 bytes [-Werror=frame-larger-than=]

This is probably harmless since it happens only in the probe function,
but there is also a relatively simple workaround, moving the regulator
match data into the device specific structure.

As a small downside, we waste a little memory at runtime. An alternative
approach would free the array at the end of the probe function, which in
turn is a little more complicated.

Fixes: f187927 ("regulator: Add support for S2MPA01 regulator")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Arnd Bergmann authored and Mark Brown committed Jan 26, 2017
1 parent d00b746 commit 33f0698
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/regulator/s2mpa01.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define S2MPA01_REGULATOR_CNT ARRAY_SIZE(regulators)

struct s2mpa01_info {
struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX];
int ramp_delay24;
int ramp_delay3;
int ramp_delay5;
Expand Down Expand Up @@ -341,16 +342,17 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev)
{
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct sec_platform_data *pdata = dev_get_platdata(iodev->dev);
struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX] = { };
struct device_node *reg_np = NULL;
struct regulator_config config = { };
struct of_regulator_match *rdata;
struct s2mpa01_info *s2mpa01;
int i;

s2mpa01 = devm_kzalloc(&pdev->dev, sizeof(*s2mpa01), GFP_KERNEL);
if (!s2mpa01)
return -ENOMEM;

rdata = s2mpa01->rdata;
for (i = 0; i < S2MPA01_REGULATOR_CNT; i++)
rdata[i].name = regulators[i].name;

Expand Down

0 comments on commit 33f0698

Please sign in to comment.