diff mbox

[PM,1/2] omap: opp: make opp_get_opp_id robust

Message ID 1274127082-16288-2-git-send-email-nm@ti.com (mailing list archive)
State New, archived
Delegated to: Kevin Hilman
Headers show

Commit Message

Nishanth Menon May 17, 2010, 8:11 p.m. UTC
None
diff mbox

Patch

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;
 }