Skip to content

Commit

Permalink
OMAP2+: mailbox: fix lookups for multiple mailboxes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kevin Hilman authored and Tony Lindgren committed Feb 14, 2011
1 parent eca8325 commit c037732
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions arch/arm/plat-omap/mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,18 @@ static void omap_mbox_fini(struct omap_mbox *mbox)

struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb)
{
struct omap_mbox *mbox;
int ret;
struct omap_mbox *_mbox, *mbox = NULL;
int i, ret;

if (!mboxes)
return ERR_PTR(-EINVAL);

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)
return ERR_PTR(-ENOENT);
Expand Down

0 comments on commit c037732

Please sign in to comment.