From: Michal Princ (NXA17570) Date: Thu, 18 Feb 2016 07:12:08 +0000 (+0100) Subject: Fix the way the create endpoint function returns the address number when RPMSG_ADDR_A... X-Git-Tag: v2016.04~16 X-Git-Url: https://git.ti.com/gitweb?p=processor-sdk%2Fopen-amp.git;a=commitdiff_plain;h=210685ca8e1e60e2bcc70f3951d38667fbb5daa7 Fix the way the create endpoint function returns the address number when RPMSG_ADDR_ANY is passed the parameter This bug has been revealed when performing following steps: 1. create one endpoint with address RPMSG_ADDR_ANY. 2. get the address of that endpoint after it is created successfully. 3. use that address to create another endpoint. It should not create the second endpoint with address of the first endpoint but somehow both endpoints were created successfully. Restrict the endpoint address - zero address can't be assigned (due to the conflict in Linux world) Signed-off-by: Michal Princ (NXA17570) --- diff --git a/lib/rpmsg/remote_device.c b/lib/rpmsg/remote_device.c index 8134a8d..e302c9e 100644 --- a/lib/rpmsg/remote_device.c +++ b/lib/rpmsg/remote_device.c @@ -128,6 +128,9 @@ int rpmsg_rdev_init(struct remote_device **rdev, int dev_id, int role, rdev_loc->channel_destroyed = channel_destroyed; rdev_loc->default_cb = default_cb; + /* Restrict the ept address - zero address can't be assigned */ + rdev_loc->bitmap[0] = 1; + /* Initialize the virtio device */ virt_dev = &rdev_loc->virt_dev; virt_dev->device = proc; diff --git a/lib/rpmsg/rpmsg_core.c b/lib/rpmsg/rpmsg_core.c index baeea82..226c28b 100644 --- a/lib/rpmsg/rpmsg_core.c +++ b/lib/rpmsg/rpmsg_core.c @@ -709,7 +709,7 @@ int rpmsg_get_address(unsigned long *bitmap, int size) tmp32 = get_first_zero_bit(bitmap[i]); if (tmp32 < 32) { - addr = tmp32 + i + 1; + addr = tmp32 + (i*32); bitmap[i] |= (1 << tmp32); break; }