[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <0261f8b951a489859ee0fa41c584804b2e3f1557.1725783921.git.christophe.jaillet@wanadoo.fr>
Date: Sun, 8 Sep 2024 10:25:56 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Karel Balej <balejk@...fyz.cz>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH] regulator: 88pm886: Constify struct regulator_desc
'struct regulator_desc' is not modified in this driver.
Constifying this structure moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers.
On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
3251 6928 16 10195 27d3 drivers/regulator/88pm886-regulator.o
After:
=====
text data bss dec hex filename
9795 360 16 10171 27bb drivers/regulator/88pm886-regulator.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
--
Compile tested only
---
drivers/regulator/88pm886-regulator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/88pm886-regulator.c b/drivers/regulator/88pm886-regulator.c
index a38bd4f312b7..68c83a4ebda8 100644
--- a/drivers/regulator/88pm886-regulator.c
+++ b/drivers/regulator/88pm886-regulator.c
@@ -56,7 +56,7 @@ static const struct linear_range pm886_buck_volt_ranges2[] = {
REGULATOR_LINEAR_RANGE(1600000, 80, 114, 50000),
};
-static struct regulator_desc pm886_regulators[] = {
+static const struct regulator_desc pm886_regulators[] = {
{
.name = "LDO1",
.regulators_node = "regulators",
@@ -340,9 +340,9 @@ static struct regulator_desc pm886_regulators[] = {
static int pm886_regulator_probe(struct platform_device *pdev)
{
struct pm886_chip *chip = dev_get_drvdata(pdev->dev.parent);
+ const struct regulator_desc *rdesc;
struct regulator_config rcfg = { };
struct device *dev = &pdev->dev;
- struct regulator_desc *rdesc;
struct regulator_dev *rdev;
struct i2c_client *page;
struct regmap *regmap;
--
2.46.0
Powered by blists - more mailing lists