linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] regulator: max77620: check for valid regulator info
@ 2016-06-27 11:43 Venkat Reddy Talla
  2016-06-27 16:14 ` Mark Brown
  2016-06-29 18:04 ` Applied "regulator: max77620: check for valid regulator info" to the regulator tree Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Venkat Reddy Talla @ 2016-06-27 11:43 UTC (permalink / raw)
  To: lgirdwood, broonie, linux-kernel; +Cc: ldewangan, vreddytalla

Check for valid regulator information data before
configuring FPS source and FPS power up/down
period to avoid NULL pointer exception if entries for
PMIC regulators not provided through device tree.
SD4 regulator is not supported by MAX77620 PMIC, removing
SD4 entry from regulator information list.

Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
---
 drivers/regulator/max77620-regulator.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c
index 321e804..a1b49a6 100644
--- a/drivers/regulator/max77620-regulator.c
+++ b/drivers/regulator/max77620-regulator.c
@@ -123,6 +123,9 @@ static int max77620_regulator_set_fps_src(struct max77620_regulator *pmic,
 	unsigned int val;
 	int ret;
 
+	if (!rinfo)
+		return 0;
+
 	switch (fps_src) {
 	case MAX77620_FPS_SRC_0:
 	case MAX77620_FPS_SRC_1:
@@ -171,6 +174,9 @@ static int max77620_regulator_set_fps_slots(struct max77620_regulator *pmic,
 	int pd = rpdata->active_fps_pd_slot;
 	int ret = 0;
 
+	if (!rinfo)
+		return 0;
+
 	if (is_suspend) {
 		pu = rpdata->suspend_fps_pu_slot;
 		pd = rpdata->suspend_fps_pd_slot;
@@ -680,7 +686,6 @@ static struct max77620_regulator_info max77620_regs_info[MAX77620_NUM_REGS] = {
 	RAIL_SD(SD1, sd1, "in-sd1", SD1, 600000, 1550000, 12500, 0x22, SD1),
 	RAIL_SD(SD2, sd2, "in-sd2", SDX, 600000, 3787500, 12500, 0xFF, NONE),
 	RAIL_SD(SD3, sd3, "in-sd3", SDX, 600000, 3787500, 12500, 0xFF, NONE),
-	RAIL_SD(SD4, sd4, "in-sd4", SDX, 600000, 3787500, 12500, 0xFF, NONE),
 
 	RAIL_LDO(LDO0, ldo0, "in-ldo0-1", N, 800000, 2375000, 25000),
 	RAIL_LDO(LDO1, ldo1, "in-ldo0-1", N, 800000, 2375000, 25000),
-- 
2.1.4

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

* Re: [PATCH 1/1] regulator: max77620: check for valid regulator info
  2016-06-27 11:43 [PATCH 1/1] regulator: max77620: check for valid regulator info Venkat Reddy Talla
@ 2016-06-27 16:14 ` Mark Brown
  2016-06-28  4:35   ` Venkat Reddy Talla
  2016-06-29 18:04 ` Applied "regulator: max77620: check for valid regulator info" to the regulator tree Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2016-06-27 16:14 UTC (permalink / raw)
  To: Venkat Reddy Talla; +Cc: lgirdwood, linux-kernel, ldewangan

[-- Attachment #1: Type: text/plain, Size: 663 bytes --]

On Mon, Jun 27, 2016 at 05:13:44PM +0530, Venkat Reddy Talla wrote:
> Check for valid regulator information data before
> configuring FPS source and FPS power up/down
> period to avoid NULL pointer exception if entries for
> PMIC regulators not provided through device tree.

This sounds like it's papering over a bug in the driver - the driver
should be able to instantiate without anything beyond the registration
of the device.  What's the driver relying on from the DT?

> SD4 regulator is not supported by MAX77620 PMIC, removing
> SD4 entry from regulator information list.

This appears to be a separate change to the above and should be a
separate patch.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* RE: [PATCH 1/1] regulator: max77620: check for valid regulator info
  2016-06-27 16:14 ` Mark Brown
@ 2016-06-28  4:35   ` Venkat Reddy Talla
  2016-06-28 19:30     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Venkat Reddy Talla @ 2016-06-28  4:35 UTC (permalink / raw)
  To: Mark Brown; +Cc: lgirdwood, linux-kernel, Laxman Dewangan

> * PGP Signed by an unknown key
> 
> On Mon, Jun 27, 2016 at 05:13:44PM +0530, Venkat Reddy Talla wrote:
> > Check for valid regulator information data before configuring FPS
> > source and FPS power up/down period to avoid NULL pointer exception if
> > entries for PMIC regulators not provided through device tree.
> 
> This sounds like it's papering over a bug in the driver - the driver should be
> able to instantiate without anything beyond the registration of the device.
> What's the driver relying on from the DT?
> 
Sorry for confusion, there is no dependent on DTS entry, I mean, in probe
SD4 regulator for MAX77620 PMIC is not registered with regulator core framework so
Regulator info will be null.

> > SD4 regulator is not supported by MAX77620 PMIC, removing
> > SD4 entry from regulator information list.
> 
> This appears to be a separate change to the above and should be a separate
> patch.
> 
Regulator info data will be null since SD4 regulator is not getting registered with core framework,
MAX77620 not supporting SD4 regulator, due to this reason I have included this change as part of this patch.
I will change the commit message and push another patch on top of this patch.

Thanks for review.

> * Unknown Key
> * 0x5D5487D0

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

* Re: [PATCH 1/1] regulator: max77620: check for valid regulator info
  2016-06-28  4:35   ` Venkat Reddy Talla
@ 2016-06-28 19:30     ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2016-06-28 19:30 UTC (permalink / raw)
  To: Venkat Reddy Talla; +Cc: lgirdwood, linux-kernel, Laxman Dewangan

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

On Tue, Jun 28, 2016 at 04:35:56AM +0000, Venkat Reddy Talla wrote:

> > This sounds like it's papering over a bug in the driver - the driver should be
> > able to instantiate without anything beyond the registration of the device.
> > What's the driver relying on from the DT?

> Sorry for confusion, there is no dependent on DTS entry, I mean, in probe
> SD4 regulator for MAX77620 PMIC is not registered with regulator core framework so
> Regulator info will be null.

OK, can you please clarify this in the changelog?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Applied "regulator: max77620: check for valid regulator info" to the regulator tree
  2016-06-27 11:43 [PATCH 1/1] regulator: max77620: check for valid regulator info Venkat Reddy Talla
  2016-06-27 16:14 ` Mark Brown
@ 2016-06-29 18:04 ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2016-06-29 18:04 UTC (permalink / raw)
  To: Venkat Reddy Talla
  Cc: Mark Brown, lgirdwood, broonie, linux-kernel, ldewangan, vreddytalla

The patch

   regulator: max77620: check for valid regulator info

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

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 91ff811f32763ea3135e832f7c1aeafc85ae1c98 Mon Sep 17 00:00:00 2001
From: Venkat Reddy Talla <vreddytalla@nvidia.com>
Date: Wed, 29 Jun 2016 15:31:27 +0530
Subject: [PATCH] regulator: max77620: check for valid regulator info

SD4 regulator is not registered with regulator core
framework in probe as there is no support in MAX77620 PMIC,
removing SD4 entry from MAX77620 regulator information list
and checking for valid regulator information data before
configuring FPS source and FPS power up/down period to avoid
NULL pointer exception if regulator not registered with core.

Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/max77620-regulator.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c
index 321e804aeab0..a1b49a6d538f 100644
--- a/drivers/regulator/max77620-regulator.c
+++ b/drivers/regulator/max77620-regulator.c
@@ -123,6 +123,9 @@ static int max77620_regulator_set_fps_src(struct max77620_regulator *pmic,
 	unsigned int val;
 	int ret;
 
+	if (!rinfo)
+		return 0;
+
 	switch (fps_src) {
 	case MAX77620_FPS_SRC_0:
 	case MAX77620_FPS_SRC_1:
@@ -171,6 +174,9 @@ static int max77620_regulator_set_fps_slots(struct max77620_regulator *pmic,
 	int pd = rpdata->active_fps_pd_slot;
 	int ret = 0;
 
+	if (!rinfo)
+		return 0;
+
 	if (is_suspend) {
 		pu = rpdata->suspend_fps_pu_slot;
 		pd = rpdata->suspend_fps_pd_slot;
@@ -680,7 +686,6 @@ static struct max77620_regulator_info max77620_regs_info[MAX77620_NUM_REGS] = {
 	RAIL_SD(SD1, sd1, "in-sd1", SD1, 600000, 1550000, 12500, 0x22, SD1),
 	RAIL_SD(SD2, sd2, "in-sd2", SDX, 600000, 3787500, 12500, 0xFF, NONE),
 	RAIL_SD(SD3, sd3, "in-sd3", SDX, 600000, 3787500, 12500, 0xFF, NONE),
-	RAIL_SD(SD4, sd4, "in-sd4", SDX, 600000, 3787500, 12500, 0xFF, NONE),
 
 	RAIL_LDO(LDO0, ldo0, "in-ldo0-1", N, 800000, 2375000, 25000),
 	RAIL_LDO(LDO1, ldo1, "in-ldo0-1", N, 800000, 2375000, 25000),
-- 
2.8.1

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

end of thread, other threads:[~2016-06-29 18:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27 11:43 [PATCH 1/1] regulator: max77620: check for valid regulator info Venkat Reddy Talla
2016-06-27 16:14 ` Mark Brown
2016-06-28  4:35   ` Venkat Reddy Talla
2016-06-28 19:30     ` Mark Brown
2016-06-29 18:04 ` Applied "regulator: max77620: check for valid regulator info" to the regulator tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).