]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
KDS: fix BUG in change I4df35f08
authorGabriele Paoloni <gabriele.paoloni@arm.com>
Mon, 3 Dec 2012 18:08:51 +0000 (18:08 +0000)
committerGerrit <chrome-bot@google.com>
Fri, 21 Dec 2012 05:26:00 +0000 (21:26 -0800)
In the implementation of change I4df35f08 the same name
is used for the macro "pos" parameter and "head" parameter.
As consequence "head" gets corrupted. this fix introduces an
auxiliar pointer for "head" and rearrange the code to make it
a bit more readable

BUG=chromium-os:36071,chrome-os-partner:15349,chrome-os-partner:14965
TEST=Tested on Daisy Board
Signed-off-by: Gabriele Paoloni <gabriele.paoloni@arm.com>
Change-Id: Icee1c07c9a87f137cdfd87fb1fe04a83f41a44b1
Reviewed-on: https://gerrit.chromium.org/gerrit/39089
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
drivers/base/kds.c

index e3054a18d749b8524a3d6cea7019908e9f3c306e..facc2aa61afb2cfaa0af050ee2bcd84b8183a8da 100755 (executable)
@@ -415,35 +415,36 @@ static void __kds_resource_set_release_common(struct kds_resource_set *rset)
                /* were we the head of the list? (head if prev is a resource) */
                if (it->parent != KDS_RESOURCE)
                {
-                       if (!(it->state & KDS_LINK_TRIGGERED) ||
-                           (it->state & KDS_LINK_EXCLUSIVE))
-                               continue;
-
-                       /*
-                        * previous was triggered and not exclusive, so we
-                        * trigger non-exclusive until end-of-list or first
-                        * exclusive
-                        */
-                       list_for_each_entry(it, &it->link, link)
+                       if ((it->state & KDS_LINK_TRIGGERED) && !(it->state & KDS_LINK_EXCLUSIVE) )
                        {
-                               /* exclusive found, stop triggering */
-                               if (it->state & KDS_LINK_EXCLUSIVE)
-                                       break;
+                               /*
+                               * previous was triggered and not exclusive, so we
+                               * trigger non-exclusive until end-of-list or first
+                               * exclusive
+                               */
 
-                               it->state |= KDS_LINK_TRIGGERED;
-                               /* a parent to update? */
-                               if (it->parent != KDS_IGNORED)
+                               struct kds_link *it_waiting = it;
+
+                               list_for_each_entry(it, &it_waiting->link, link)
                                {
-                                       if (0 == --it->parent->pending)
+                                       /* exclusive found, stop triggering */
+                                       if (it->state & KDS_LINK_EXCLUSIVE)
+                                               break;
+
+                                       it->state |= KDS_LINK_TRIGGERED;
+                                       /* a parent to update? */
+                                       if ( (it->parent != KDS_IGNORED) && (it->parent != KDS_RESOURCE) )
                                        {
-                                               /* new owner now triggered, track for callback later */
-                                               list_add(&it->parent->callback_link, &triggered);
+                                               if (0 == --it->parent->pending)
+                                               {
+                                                       /* new owner now triggered, track for callback later */
+                                                       list_add(&it->parent->callback_link, &triggered);
+                                               }
                                        }
                                }
                        }
                        continue;
                }
-
                /* we were the head, find the kds_resource */
                resource = container_of(it, struct kds_resource, waiters);