All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v1] regulator: pfuze100: add condition check for 'ramp_delay = 0'
  2020-06-23 14:01 [PATCH v1] regulator: pfuze100: add condition check for 'ramp_delay = 0' Robin Gong
@ 2020-06-23 12:39 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2020-06-23 12:39 UTC (permalink / raw)
  To: Robin Gong, lgirdwood; +Cc: linux-imx, linux-kernel

On Tue, 23 Jun 2020 22:01:10 +0800, Robin Gong wrote:
> Checking for 'ramp_delay = 0' to avoid Coverity warning report.

Applied to

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

Thanks!

[1/1] regulator: pfuze100: add condition check for 'ramp_delay = 0'
      commit: a7503a9d8fcfac3fefdb63fc61efedef41635e94

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

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

* [PATCH v1] regulator: pfuze100: add condition check for 'ramp_delay = 0'
@ 2020-06-23 14:01 Robin Gong
  2020-06-23 12:39 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Robin Gong @ 2020-06-23 14:01 UTC (permalink / raw)
  To: lgirdwood, broonie; +Cc: linux-kernel, linux-imx

Checking for 'ramp_delay = 0' to avoid Coverity warning report.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
---
 drivers/regulator/pfuze100-regulator.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c
index 6895379..e75e61f 100644
--- a/drivers/regulator/pfuze100-regulator.c
+++ b/drivers/regulator/pfuze100-regulator.c
@@ -128,7 +128,7 @@ static int pfuze100_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
 	struct pfuze_chip *pfuze100 = rdev_get_drvdata(rdev);
 	int id = rdev_get_id(rdev);
 	bool reg_has_ramp_delay;
-	unsigned int ramp_bits;
+	unsigned int ramp_bits = 0;
 	int ret;
 
 	switch (pfuze100->chip_id) {
@@ -149,8 +149,11 @@ static int pfuze100_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
 	}
 
 	if (reg_has_ramp_delay) {
-		ramp_delay = 12500 / ramp_delay;
-		ramp_bits = (ramp_delay >> 1) - (ramp_delay >> 3);
+		if (ramp_delay > 0) {
+			ramp_delay = 12500 / ramp_delay;
+			ramp_bits = (ramp_delay >> 1) - (ramp_delay >> 3);
+		}
+
 		ret = regmap_update_bits(pfuze100->regmap,
 					 rdev->desc->vsel_reg + 4,
 					 0xc0, ramp_bits << 6);
-- 
2.7.4


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

end of thread, other threads:[~2020-06-23 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 14:01 [PATCH v1] regulator: pfuze100: add condition check for 'ramp_delay = 0' Robin Gong
2020-06-23 12:39 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.