public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PM-WIP-OPP] [PATCH 0/2] cleanups for pointer handling
@ 2010-02-16  8:27 Nishanth Menon
  2010-02-16  8:27 ` [PM-WIP-OPP] [PATCH 1/2] omap3:pm:srf: check if pointer results with IS_ERR Nishanth Menon
  2010-02-23 18:36 ` [PM-WIP-OPP] [PATCH 0/2] cleanups for pointer handling Kevin Hilman
  0 siblings, 2 replies; 4+ messages in thread
From: Nishanth Menon @ 2010-02-16  8:27 UTC (permalink / raw)
  To: Linux-OMAP; +Cc: Nishanth Menon, Ambresh K, Eduardo Valentin, Kevin Hilman

Few pointer handling related cleanup patches

Nishanth Menon (2):
  omap3:pm:srf: check if pointer results with IS_ERR
  omap:pm: return error pointers if inactive opp layer

 arch/arm/mach-omap2/resource34xx.c    |    2 +-
 arch/arm/plat-omap/include/plat/opp.h |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

Cc: Ambresh K <ambresh@ti.com>
Cc: Eduardo Valentin <eduardo.valentin@nokia.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>

Regards,
Nishanth Menon

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

* [PM-WIP-OPP] [PATCH 1/2] omap3:pm:srf: check if pointer results with IS_ERR
  2010-02-16  8:27 [PM-WIP-OPP] [PATCH 0/2] cleanups for pointer handling Nishanth Menon
@ 2010-02-16  8:27 ` Nishanth Menon
  2010-02-16  8:27   ` [PM-WIP-OPP] [PATCH 2/2] omap: opp: return error pointers if inactive opp layer Nishanth Menon
  2010-02-23 18:36 ` [PM-WIP-OPP] [PATCH 0/2] cleanups for pointer handling Kevin Hilman
  1 sibling, 1 reply; 4+ messages in thread
From: Nishanth Menon @ 2010-02-16  8:27 UTC (permalink / raw)
  To: Linux-OMAP; +Cc: Nishanth Menon, Ambresh K, Eduardo Valentin, Kevin Hilman

if we dont check the pointer returns with IS_ERR, we could
continue on with an error value as a valid pointer..

Cc: Ambresh K <ambresh@ti.com>
Cc: Eduardo Valentin <eduardo.valentin@nokia.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/resource34xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c
index 3604a38..ecc3c68 100644
--- a/arch/arm/mach-omap2/resource34xx.c
+++ b/arch/arm/mach-omap2/resource34xx.c
@@ -177,7 +177,7 @@ static int __deprecated opp_to_freq(unsigned long *freq, enum opp_t opp_type,
 	BUG_ON(!freq || opp_type >= OPP_TYPES_MAX);
 
 	opp = opp_find_by_opp_id(opp_type, opp_id);
-	if (!opp)
+	if (IS_ERR(opp))
 		return -EINVAL;
 
 	*freq = opp_get_freq(opp);
-- 
1.6.3.3


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

* [PM-WIP-OPP] [PATCH 2/2] omap: opp: return error pointers if inactive opp layer
  2010-02-16  8:27 ` [PM-WIP-OPP] [PATCH 1/2] omap3:pm:srf: check if pointer results with IS_ERR Nishanth Menon
@ 2010-02-16  8:27   ` Nishanth Menon
  0 siblings, 0 replies; 4+ messages in thread
From: Nishanth Menon @ 2010-02-16  8:27 UTC (permalink / raw)
  To: Linux-OMAP; +Cc: Nishanth Menon, Ambresh K, Eduardo Valentin, Kevin Hilman

Return ERR_PTR pointers back to caller instead of a plain
NULL to allow for callers to do sanity checks.

Cc: Ambresh K <ambresh@ti.com>
Cc: Eduardo Valentin <eduardo.valentin@nokia.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/plat-omap/include/plat/opp.h |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/opp.h b/arch/arm/plat-omap/include/plat/opp.h
index 33d224c..dc9a0d9 100644
--- a/arch/arm/plat-omap/include/plat/opp.h
+++ b/arch/arm/plat-omap/include/plat/opp.h
@@ -252,31 +252,31 @@ static inline int opp_get_opp_count(struct omap_opp *oppl)
 static inline struct omap_opp *opp_find_freq_exact(struct omap_opp *oppl,
 				     unsigned long freq, bool enabled)
 {
-	return NULL;
+	return ERR_PTR(-EINVAL);
 }
 
 static inline struct omap_opp *opp_find_freq_floor(struct omap_opp *oppl,
 				     unsigned long *freq)
 {
-	return NULL;
+	return ERR_PTR(-EINVAL);
 }
 
 static inline struct omap_opp *opp_find_freq_ceil(struct omap_opp *oppl,
 					unsigned long *freq)
 {
-	return NULL;
+	return ERR_PTR(-EINVAL);
 }
 
 static inline
 struct omap_opp __init *opp_init_list(const struct omap_opp_def *opp_defs)
 {
-	return NULL;
+	return ERR_PTR(-EINVAL);
 }
 
 static inline struct omap_opp *opp_add(struct omap_opp *oppl,
 			 const struct omap_opp_def *opp_def)
 {
-	return NULL;
+	return ERR_PTR(-EINVAL);
 }
 
 static inline int opp_enable(struct omap_opp *opp)
@@ -292,7 +292,7 @@ static inline int opp_disable(struct omap_opp *opp)
 static inline struct omap_opp * __deprecated
 opp_find_by_opp_id(struct omap_opp *opps, u8 opp_id)
 {
-	return NULL;
+	return ERR_PTR(-EINVAL);
 }
 
 static inline u8 __deprecated opp_get_opp_id(struct omap_opp *opp)
-- 
1.6.3.3


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

* Re: [PM-WIP-OPP] [PATCH 0/2] cleanups for pointer handling
  2010-02-16  8:27 [PM-WIP-OPP] [PATCH 0/2] cleanups for pointer handling Nishanth Menon
  2010-02-16  8:27 ` [PM-WIP-OPP] [PATCH 1/2] omap3:pm:srf: check if pointer results with IS_ERR Nishanth Menon
@ 2010-02-23 18:36 ` Kevin Hilman
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2010-02-23 18:36 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: Linux-OMAP, Ambresh K, Eduardo Valentin

Nishanth Menon <nm@ti.com> writes:

> Few pointer handling related cleanup patches
>
> Nishanth Menon (2):
>   omap3:pm:srf: check if pointer results with IS_ERR
>   omap:pm: return error pointers if inactive opp layer
>
>  arch/arm/mach-omap2/resource34xx.c    |    2 +-
>  arch/arm/plat-omap/include/plat/opp.h |   12 ++++++------
>  2 files changed, 7 insertions(+), 7 deletions(-)
>
> Cc: Ambresh K <ambresh@ti.com>
> Cc: Eduardo Valentin <eduardo.valentin@nokia.com>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>

Thanks, applying to pm-wip-opp.

Kevin

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

end of thread, other threads:[~2010-02-23 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-16  8:27 [PM-WIP-OPP] [PATCH 0/2] cleanups for pointer handling Nishanth Menon
2010-02-16  8:27 ` [PM-WIP-OPP] [PATCH 1/2] omap3:pm:srf: check if pointer results with IS_ERR Nishanth Menon
2010-02-16  8:27   ` [PM-WIP-OPP] [PATCH 2/2] omap: opp: return error pointers if inactive opp layer Nishanth Menon
2010-02-23 18:36 ` [PM-WIP-OPP] [PATCH 0/2] cleanups for pointer handling Kevin Hilman

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