Commit 50e36be1 authored by Aymeric Agon-Rambosson's avatar Aymeric Agon-Rambosson Committed by Linus Torvalds

scripts/gdb: repair rb_first() and rb_last()

The current implementations of the rb_first() and rb_last() gdb
functions have a variable that references itself in its instanciation,
which causes the function to throw an error if a specific condition on
the argument is met.  The original author rather intended to reference
the argument and made a typo.  Referring the argument instead makes the
function work as intended.
Signed-off-by: default avatarAymeric Agon-Rambosson <aymeric.agon@yandex.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Nikolay Borisov <n.borisov.lkml@gmail.com>
Cc: Jackie Liu <liuyun01@kylinos.cn>
Cc: Jason Wessel <jason.wessel@windriver.com>
Link: http://lkml.kernel.org/r/20200427051029.354840-1-aymeric.agon@yandex.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0c54a6a4
...@@ -12,7 +12,7 @@ rb_node_type = utils.CachedType("struct rb_node") ...@@ -12,7 +12,7 @@ rb_node_type = utils.CachedType("struct rb_node")
def rb_first(root): def rb_first(root):
if root.type == rb_root_type.get_type(): if root.type == rb_root_type.get_type():
node = node.address.cast(rb_root_type.get_type().pointer()) node = root.address.cast(rb_root_type.get_type().pointer())
elif root.type != rb_root_type.get_type().pointer(): elif root.type != rb_root_type.get_type().pointer():
raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
...@@ -28,7 +28,7 @@ def rb_first(root): ...@@ -28,7 +28,7 @@ def rb_first(root):
def rb_last(root): def rb_last(root):
if root.type == rb_root_type.get_type(): if root.type == rb_root_type.get_type():
node = node.address.cast(rb_root_type.get_type().pointer()) node = root.address.cast(rb_root_type.get_type().pointer())
elif root.type != rb_root_type.get_type().pointer(): elif root.type != rb_root_type.get_type().pointer():
raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment