summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Jan <s-jan@ti.com>2011-12-16 13:05:30 +0800
committerAndy Green <andy.green@linaro.org>2012-01-09 08:39:32 +0800
commit6f453c5bedd363019bb8c1ddd3a1ecd42aafc1ab (patch)
tree613ea443796543950c58c3aa496b134f017b35c3
parent52921d22c38427bdad3ddbefbc1664061cebf58c (diff)
OMAP2+: mailbox: fix lookups for multiple mailboxes
Re-apply the following patch. It was partially reverted by a merge with mutex addition. This fix is required because, as expected, the concerned code generates an error with gcc4.6 (but not with gcc4.5!). OMAP2+: mailbox: fix lookups for multiple mailboxes The pointer math in omap_mbox_get() is not quite right, and leads to passing NULL to strcmp() when searching for an mbox that is not first in the list. Convert to using array indexing as is done in all the other functions which walk the mbox list. Tested on OMAP2420/n810, OMAP3630/zoom3, OMAP4430/Blaze Signed-off-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Conflicts: arch/arm/plat-omap/mailbox.c Signed-off-by: Sebastien Jan <s-jan@ti.com>
-rw-r--r--arch/arm/plat-omap/mailbox.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 607ea1fc3fe..6c3ea764c01 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -352,9 +352,12 @@ struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb)
return ERR_PTR(-EINVAL);
mutex_lock(&mboxes_lock);
- for (mbox = *mboxes; mbox; mbox++)
- if (!strcmp(mbox->name, name))
+ for (i = 0; (_mbox = mboxes[i]); i++) {
+ if (!strcmp(_mbox->name, name)) {
+ mbox = _mbox;
break;
+ }
+ }
if (!mbox) {
mutex_unlock(&mboxes_lock);