cleanups for pointer handling
Subsystems (3)
cover cleanups for pointer handling
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(-)
Regards,
Nishanth Menon
PATCH 1/2 omap3:pm:srf: check if pointer results with IS_ERR
if we dont check the pointer returns with IS_ERR, we could continue on with an error value as a valid pointer..
--- arch/arm/mach-omap2/resource34xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/resource34xx.c +1 -1
@@ -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);
Signature · 1 line
1.6.3.3
PATCH 2/2 omap: opp: return error pointers if inactive opp layer
Return ERR_PTR pointers back to caller instead of a plain NULL to allow for callers to do sanity checks.
--- arch/arm/plat-omap/include/plat/opp.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/plat-omap/include/plat/opp.h +6 -6
@@ -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)
Signature · 1 line
1.6.3.3
Quoted 6 lines · Nishanth Menon
Few pointer handling related cleanup patches
Nishanth Menon (2):
omap3:pm:srf: check if pointer results withIS_ERRomap:pm: return error pointers if inactive opp layer
Quoted 7 lines
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 <[email protected]>Cc Eduardo Valentin <[email protected]>Cc Kevin Hilman <[email protected]>
Thanks, applying to pm-wip-opp.
Kevin