LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator
@ 2019-11-06 17:31 Stephan Gerhold
  2019-11-06 17:31 ` [PATCH 2/2] regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id Stephan Gerhold
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stephan Gerhold @ 2019-11-06 17:31 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Stephan Gerhold, Linus Walleij

The USB regulator was removed for AB8500 in
commit 41a06aa738ad ("regulator: ab8500: Remove USB regulator").
It was then added for AB8505 in
commit 547f384f33db ("regulator: ab8500: add support for ab8505").

However, there was never an entry added for it in
ab8505_regulator_match. This causes all regulators after it
to be initialized with the wrong device tree data, eventually
leading to an out-of-bounds array read.

Given that it is not used anywhere in the kernel, it seems
likely that similar arguments against supporting it exist for
AB8505 (it is controlled by hardware).

Therefore, simply remove it like for AB8500 instead of adding
an entry in ab8505_regulator_match.

Fixes: 547f384f33db ("regulator: ab8500: add support for ab8505")
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 drivers/regulator/ab8500.c       | 17 -----------------
 include/linux/regulator/ab8500.h |  1 -
 2 files changed, 18 deletions(-)

diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index efb2f01a9101..f60e1b26c2d2 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -953,23 +953,6 @@ static struct ab8500_regulator_info
 		.update_val_idle	= 0x82,
 		.update_val_normal	= 0x02,
 	},
-	[AB8505_LDO_USB] = {
-		.desc = {
-			.name           = "LDO-USB",
-			.ops            = &ab8500_regulator_mode_ops,
-			.type           = REGULATOR_VOLTAGE,
-			.id             = AB8505_LDO_USB,
-			.owner          = THIS_MODULE,
-			.n_voltages     = 1,
-			.volt_table	= fixed_3300000_voltage,
-		},
-		.update_bank            = 0x03,
-		.update_reg             = 0x82,
-		.update_mask            = 0x03,
-		.update_val		= 0x01,
-		.update_val_idle	= 0x03,
-		.update_val_normal	= 0x01,
-	},
 	[AB8505_LDO_AUDIO] = {
 		.desc = {
 			.name		= "LDO-AUDIO",
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 7cf8f797e13a..505e94a6e3e8 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -37,7 +37,6 @@ enum ab8505_regulator_id {
 	AB8505_LDO_AUX6,
 	AB8505_LDO_INTCORE,
 	AB8505_LDO_ADC,
-	AB8505_LDO_USB,
 	AB8505_LDO_AUDIO,
 	AB8505_LDO_ANAMIC1,
 	AB8505_LDO_ANAMIC2,
-- 
2.23.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id
  2019-11-06 17:31 [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator Stephan Gerhold
@ 2019-11-06 17:31 ` Stephan Gerhold
  2019-11-07  8:02   ` Linus Walleij
  2019-11-07 13:13   ` Applied "regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id" to the regulator tree Mark Brown
  2019-11-07  8:02 ` [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator Linus Walleij
  2019-11-07 13:13 ` Applied "regulator: ab8500: Remove AB8505 USB regulator" to the regulator tree Mark Brown
  2 siblings, 2 replies; 8+ messages in thread
From: Stephan Gerhold @ 2019-11-06 17:31 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Stephan Gerhold, Linus Walleij

Those regulators are not actually supported by the AB8500 regulator
driver. There is no ab8500_regulator_info for them and no entry in
ab8505_regulator_match.

As such, they cannot be registered successfully, and looking them
up in ab8505_regulator_match causes an out-of-bounds array read.

Fixes: 547f384f33db ("regulator: ab8500: add support for ab8505")
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 include/linux/regulator/ab8500.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 505e94a6e3e8..3ab1ddf151a2 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -42,8 +42,6 @@ enum ab8505_regulator_id {
 	AB8505_LDO_ANAMIC2,
 	AB8505_LDO_AUX8,
 	AB8505_LDO_ANA,
-	AB8505_SYSCLKREQ_2,
-	AB8505_SYSCLKREQ_4,
 	AB8505_NUM_REGULATORS,
 };
 
-- 
2.23.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator
  2019-11-06 17:31 [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator Stephan Gerhold
  2019-11-06 17:31 ` [PATCH 2/2] regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id Stephan Gerhold
@ 2019-11-07  8:02 ` Linus Walleij
  2020-01-10  8:02   ` Naresh Kamboju
  2019-11-07 13:13 ` Applied "regulator: ab8500: Remove AB8505 USB regulator" to the regulator tree Mark Brown
  2 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2019-11-07  8:02 UTC (permalink / raw)
  To: Stephan Gerhold; +Cc: Mark Brown, Liam Girdwood, linux-kernel

On Wed, Nov 6, 2019 at 6:33 PM Stephan Gerhold <stephan@gerhold.net> wrote:

> The USB regulator was removed for AB8500 in
> commit 41a06aa738ad ("regulator: ab8500: Remove USB regulator").
> It was then added for AB8505 in
> commit 547f384f33db ("regulator: ab8500: add support for ab8505").
>
> However, there was never an entry added for it in
> ab8505_regulator_match. This causes all regulators after it
> to be initialized with the wrong device tree data, eventually
> leading to an out-of-bounds array read.
>
> Given that it is not used anywhere in the kernel, it seems
> likely that similar arguments against supporting it exist for
> AB8505 (it is controlled by hardware).
>
> Therefore, simply remove it like for AB8500 instead of adding
> an entry in ab8505_regulator_match.
>
> Fixes: 547f384f33db ("regulator: ab8500: add support for ab8505")
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id
  2019-11-06 17:31 ` [PATCH 2/2] regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id Stephan Gerhold
@ 2019-11-07  8:02   ` Linus Walleij
  2019-11-07 13:13   ` Applied "regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id" to the regulator tree Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2019-11-07  8:02 UTC (permalink / raw)
  To: Stephan Gerhold; +Cc: Mark Brown, Liam Girdwood, linux-kernel

On Wed, Nov 6, 2019 at 6:33 PM Stephan Gerhold <stephan@gerhold.net> wrote:

> Those regulators are not actually supported by the AB8500 regulator
> driver. There is no ab8500_regulator_info for them and no entry in
> ab8505_regulator_match.
>
> As such, they cannot be registered successfully, and looking them
> up in ab8505_regulator_match causes an out-of-bounds array read.
>
> Fixes: 547f384f33db ("regulator: ab8500: add support for ab8505")
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Applied "regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id" to the regulator tree
  2019-11-06 17:31 ` [PATCH 2/2] regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id Stephan Gerhold
  2019-11-07  8:02   ` Linus Walleij
@ 2019-11-07 13:13   ` Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2019-11-07 13:13 UTC (permalink / raw)
  To: Stephan Gerhold; +Cc: Liam Girdwood, Linus Walleij, linux-kernel, Mark Brown

The patch

   regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id

has been applied to the regulator tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.5

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 458ea3ad033fc86e291712ce50cbe60c3428cf30 Mon Sep 17 00:00:00 2001
From: Stephan Gerhold <stephan@gerhold.net>
Date: Wed, 6 Nov 2019 18:31:25 +0100
Subject: [PATCH] regulator: ab8500: Remove SYSCLKREQ from enum
 ab8505_regulator_id

Those regulators are not actually supported by the AB8500 regulator
driver. There is no ab8500_regulator_info for them and no entry in
ab8505_regulator_match.

As such, they cannot be registered successfully, and looking them
up in ab8505_regulator_match causes an out-of-bounds array read.

Fixes: 547f384f33db ("regulator: ab8500: add support for ab8505")
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20191106173125.14496-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 include/linux/regulator/ab8500.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 505e94a6e3e8..3ab1ddf151a2 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -42,8 +42,6 @@ enum ab8505_regulator_id {
 	AB8505_LDO_ANAMIC2,
 	AB8505_LDO_AUX8,
 	AB8505_LDO_ANA,
-	AB8505_SYSCLKREQ_2,
-	AB8505_SYSCLKREQ_4,
 	AB8505_NUM_REGULATORS,
 };
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Applied "regulator: ab8500: Remove AB8505 USB regulator" to the regulator tree
  2019-11-06 17:31 [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator Stephan Gerhold
  2019-11-06 17:31 ` [PATCH 2/2] regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id Stephan Gerhold
  2019-11-07  8:02 ` [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator Linus Walleij
@ 2019-11-07 13:13 ` Mark Brown
  2 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2019-11-07 13:13 UTC (permalink / raw)
  To: Stephan Gerhold; +Cc: Liam Girdwood, Linus Walleij, linux-kernel, Mark Brown

The patch

   regulator: ab8500: Remove AB8505 USB regulator

has been applied to the regulator tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.5

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 99c4f70df3a6446c56ca817c2d0f9c12d85d4e7c Mon Sep 17 00:00:00 2001
From: Stephan Gerhold <stephan@gerhold.net>
Date: Wed, 6 Nov 2019 18:31:24 +0100
Subject: [PATCH] regulator: ab8500: Remove AB8505 USB regulator

The USB regulator was removed for AB8500 in
commit 41a06aa738ad ("regulator: ab8500: Remove USB regulator").
It was then added for AB8505 in
commit 547f384f33db ("regulator: ab8500: add support for ab8505").

However, there was never an entry added for it in
ab8505_regulator_match. This causes all regulators after it
to be initialized with the wrong device tree data, eventually
leading to an out-of-bounds array read.

Given that it is not used anywhere in the kernel, it seems
likely that similar arguments against supporting it exist for
AB8505 (it is controlled by hardware).

Therefore, simply remove it like for AB8500 instead of adding
an entry in ab8505_regulator_match.

Fixes: 547f384f33db ("regulator: ab8500: add support for ab8505")
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20191106173125.14496-1-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/ab8500.c       | 17 -----------------
 include/linux/regulator/ab8500.h |  1 -
 2 files changed, 18 deletions(-)

diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index efb2f01a9101..f60e1b26c2d2 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -953,23 +953,6 @@ static struct ab8500_regulator_info
 		.update_val_idle	= 0x82,
 		.update_val_normal	= 0x02,
 	},
-	[AB8505_LDO_USB] = {
-		.desc = {
-			.name           = "LDO-USB",
-			.ops            = &ab8500_regulator_mode_ops,
-			.type           = REGULATOR_VOLTAGE,
-			.id             = AB8505_LDO_USB,
-			.owner          = THIS_MODULE,
-			.n_voltages     = 1,
-			.volt_table	= fixed_3300000_voltage,
-		},
-		.update_bank            = 0x03,
-		.update_reg             = 0x82,
-		.update_mask            = 0x03,
-		.update_val		= 0x01,
-		.update_val_idle	= 0x03,
-		.update_val_normal	= 0x01,
-	},
 	[AB8505_LDO_AUDIO] = {
 		.desc = {
 			.name		= "LDO-AUDIO",
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 7cf8f797e13a..505e94a6e3e8 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -37,7 +37,6 @@ enum ab8505_regulator_id {
 	AB8505_LDO_AUX6,
 	AB8505_LDO_INTCORE,
 	AB8505_LDO_ADC,
-	AB8505_LDO_USB,
 	AB8505_LDO_AUDIO,
 	AB8505_LDO_ANAMIC1,
 	AB8505_LDO_ANAMIC2,
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator
  2019-11-07  8:02 ` [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator Linus Walleij
@ 2020-01-10  8:02   ` Naresh Kamboju
  2020-01-10  8:16     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 8+ messages in thread
From: Naresh Kamboju @ 2020-01-10  8:02 UTC (permalink / raw)
  To: Linus Walleij, Greg Kroah-Hartman, Sasha Levin
  Cc: Stephan Gerhold, Mark Brown, Liam Girdwood, linux-kernel, linux- stable

On Thu, 7 Nov 2019 at 13:32, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Wed, Nov 6, 2019 at 6:33 PM Stephan Gerhold <stephan@gerhold.net> wrote:
>
> > The USB regulator was removed for AB8500 in
> > commit 41a06aa738ad ("regulator: ab8500: Remove USB regulator").
> > It was then added for AB8505 in
> > commit 547f384f33db ("regulator: ab8500: add support for ab8505").
> >

Stable-rc 4.4 branch arm build failed due to this error.

arch/arm/mach-ux500/board-mop500-regulators.c:957:3: error:
'AB8505_LDO_USB' undeclared here (not in a function); did you mean
'AB9540_LDO_USB'?
  [AB8505_LDO_USB] = {
   ^~~~~~~~~~~~~~
   AB9540_LDO_USB
arch/arm/mach-ux500/board-mop500-regulators.c:957:3: error: array
index in initializer not of integer type
arch/arm/mach-ux500/board-mop500-regulators.c:957:3: note: (near
initialization for 'ab8505_regulators')

Full build log,
https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.4/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/703/consoleText

--
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator
  2020-01-10  8:02   ` Naresh Kamboju
@ 2020-01-10  8:16     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2020-01-10  8:16 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: Linus Walleij, Sasha Levin, Stephan Gerhold, Mark Brown,
	Liam Girdwood, linux-kernel, linux- stable

On Fri, Jan 10, 2020 at 01:32:57PM +0530, Naresh Kamboju wrote:
> On Thu, 7 Nov 2019 at 13:32, Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Wed, Nov 6, 2019 at 6:33 PM Stephan Gerhold <stephan@gerhold.net> wrote:
> >
> > > The USB regulator was removed for AB8500 in
> > > commit 41a06aa738ad ("regulator: ab8500: Remove USB regulator").
> > > It was then added for AB8505 in
> > > commit 547f384f33db ("regulator: ab8500: add support for ab8505").
> > >
> 
> Stable-rc 4.4 branch arm build failed due to this error.
> 
> arch/arm/mach-ux500/board-mop500-regulators.c:957:3: error:
> 'AB8505_LDO_USB' undeclared here (not in a function); did you mean
> 'AB9540_LDO_USB'?
>   [AB8505_LDO_USB] = {
>    ^~~~~~~~~~~~~~
>    AB9540_LDO_USB
> arch/arm/mach-ux500/board-mop500-regulators.c:957:3: error: array
> index in initializer not of integer type
> arch/arm/mach-ux500/board-mop500-regulators.c:957:3: note: (near
> initialization for 'ab8505_regulators')
> 
> Full build log,
> https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.4/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/703/consoleText
> 

Good catch, I'll go drop this patch from the 4.4.y queue now, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 17:31 [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator Stephan Gerhold
2019-11-06 17:31 ` [PATCH 2/2] regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id Stephan Gerhold
2019-11-07  8:02   ` Linus Walleij
2019-11-07 13:13   ` Applied "regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id" to the regulator tree Mark Brown
2019-11-07  8:02 ` [PATCH 1/2] regulator: ab8500: Remove AB8505 USB regulator Linus Walleij
2020-01-10  8:02   ` Naresh Kamboju
2020-01-10  8:16     ` Greg Kroah-Hartman
2019-11-07 13:13 ` Applied "regulator: ab8500: Remove AB8505 USB regulator" to the regulator tree Mark Brown

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git