mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: da9063: Fix PTR_ERR/ERR_PTR mismatch
@ 2013-09-09 11:49 Geert Uytterhoeven
  2013-09-09 11:49 ` [PATCH 2/2] regulator: da9063: Add missing initialization of da9063_reg_matches Geert Uytterhoeven
  2013-09-10 17:12 ` [PATCH 1/2] regulator: da9063: Fix PTR_ERR/ERR_PTR mismatch Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2013-09-09 11:49 UTC (permalink / raw)
  To: Krystian Garbaciak, Philipp Zabel, Mark Brown
  Cc: linux-kernel, Geert Uytterhoeven

If CONFIG_OF=n:

drivers/regulator/da9063-regulator.c: In function ‘da9063_parse_regulators_dt’:
drivers/regulator/da9063-regulator.c:712: warning: passing argument 1 of ‘PTR_ERR’ makes pointer from integer without a cast
drivers/regulator/da9063-regulator.c:712: warning: return makes pointer from integer without a cast

Use ERR_PTR() to encode an error code in a pointer.
PTR_ERR() is meant to decode an error code from a pointer.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/regulator/da9063-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 1a78163..b9f2653 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -709,7 +709,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
 		struct of_regulator_match **da9063_reg_matches)
 {
 	da9063_reg_matches = NULL;
-	return PTR_ERR(-ENODEV);
+	return ERR_PTR(-ENODEV);
 }
 #endif
 
-- 
1.7.9.5


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

* [PATCH 2/2] regulator: da9063: Add missing initialization of da9063_reg_matches
  2013-09-09 11:49 [PATCH 1/2] regulator: da9063: Fix PTR_ERR/ERR_PTR mismatch Geert Uytterhoeven
@ 2013-09-09 11:49 ` Geert Uytterhoeven
  2013-09-10 17:12 ` [PATCH 1/2] regulator: da9063: Fix PTR_ERR/ERR_PTR mismatch Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2013-09-09 11:49 UTC (permalink / raw)
  To: Krystian Garbaciak, Philipp Zabel, Mark Brown
  Cc: linux-kernel, Geert Uytterhoeven

With gcc 4.1.2:

drivers/regulator/da9063-regulator.c: In function ‘da9063_regulator_probe’:
drivers/regulator/da9063-regulator.c:847: warning: ‘da9063_reg_matches’ is used
uninitialized in this function

If the parent device already has platform data, da9063_reg_matches will
not be initialized.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Can this happen? Or will any of the b*_merged flags be set in this case, so
the while loop continues and we never get to the place where
da9063_reg_matches is used? The code is too convoluted for me to see...

 drivers/regulator/da9063-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index b9f2653..3d910f4 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -717,7 +717,7 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 {
 	struct da9063 *da9063 = dev_get_drvdata(pdev->dev.parent);
 	struct da9063_pdata *da9063_pdata = dev_get_platdata(da9063->dev);
-	struct of_regulator_match *da9063_reg_matches;
+	struct of_regulator_match *da9063_reg_matches = NULL;
 	struct da9063_regulators_pdata *regl_pdata;
 	const struct da9063_dev_model *model;
 	struct da9063_regulators *regulators;
-- 
1.7.9.5


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

* Re: [PATCH 1/2] regulator: da9063: Fix PTR_ERR/ERR_PTR mismatch
  2013-09-09 11:49 [PATCH 1/2] regulator: da9063: Fix PTR_ERR/ERR_PTR mismatch Geert Uytterhoeven
  2013-09-09 11:49 ` [PATCH 2/2] regulator: da9063: Add missing initialization of da9063_reg_matches Geert Uytterhoeven
@ 2013-09-10 17:12 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2013-09-10 17:12 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Krystian Garbaciak, Philipp Zabel, linux-kernel

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

On Mon, Sep 09, 2013 at 01:49:26PM +0200, Geert Uytterhoeven wrote:
> If CONFIG_OF=n:
> 
> drivers/regulator/da9063-regulator.c: In function ‘da9063_parse_regulators_dt’:

Applied both, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-09-10 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-09 11:49 [PATCH 1/2] regulator: da9063: Fix PTR_ERR/ERR_PTR mismatch Geert Uytterhoeven
2013-09-09 11:49 ` [PATCH 2/2] regulator: da9063: Add missing initialization of da9063_reg_matches Geert Uytterhoeven
2013-09-10 17:12 ` [PATCH 1/2] regulator: da9063: Fix PTR_ERR/ERR_PTR mismatch Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®