From ed87187ae5daf451253c4850d894518c99337a0e Mon Sep 17 00:00:00 2001 From: Sebastien Jan Date: Tue, 25 Oct 2011 10:51:57 +0800 Subject: 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 Signed-off-by: Tony Lindgren Conflicts: arch/arm/plat-omap/mailbox.c Signed-off-by: Sebastien Jan --- arch/arm/plat-omap/mailbox.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index b6137aa0321..dea4a22604b 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c @@ -351,9 +351,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); -- cgit v1.2.3