opp_get_opp_id should handle the error cases that might hit it. check parameters before using it
Signed-off-by: Nishanth Menon <[email protected]> Cc: Eduardo Valentin <[email protected]> Cc: Jouni Hogander <[email protected]> Cc: Kevin Hilman <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Rajendra Nayak <[email protected]> Cc: Sanjeev Premi <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Vishwanath BS <[email protected]> --- Note: even though this is a deprecated function, it should be robust arch/arm/plat-omap/opp.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/opp.c b/arch/arm/plat-omap/opp.c index 229960d..0b61325 100644 --- a/arch/arm/plat-omap/opp.c +++ b/arch/arm/plat-omap/opp.c @@ -101,6 +101,10 @@ struct omap_opp * __deprecated opp_find_by_opp_id(enum opp_t opp_type, u8 __deprecated opp_get_opp_id(struct omap_opp *opp) { + if (unlikely(!opp || IS_ERR(opp)) || !opp->enabled) { + pr_err("%s: Invalid parameter being passed\n", __func__); + return 0; + } return opp->opp_id; } -- 1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
