[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1d3fd4db13d999a3ba57f5bbc1924862d824f61.1556881728.git.leonard.crestez@nxp.com>
Date: Fri, 3 May 2019 11:19:31 +0000
From: Leonard Crestez <leonard.crestez@....com>
To: Stephen Boyd <sboyd@...nel.org>,
Kieran Bingham <kbingham@...nel.org>,
Jan Kiszka <jan.kiszka@...mens.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Michael Turquette <mturquette@...libre.com>,
"linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] scripts/gdb: Cleanup error handling in list helpers
An incorrect argument to list_for_each is an internal error in gdb
scripts so a TypeError should be raised. The gdb.GdbError exception type
is intended for user errors such as incorrect invocation.
Drop the type assertion in list_for_each_entry because list_for_each isn't
going to suddenly yield something else.
Applies to both list and hlist
Signed-off-by: Leonard Crestez <leonard.crestez@....com>
---
scripts/gdb/linux/lists.py | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/scripts/gdb/linux/lists.py b/scripts/gdb/linux/lists.py
index 55356b66f8ea..c487ddf09d38 100644
--- a/scripts/gdb/linux/lists.py
+++ b/scripts/gdb/linux/lists.py
@@ -22,45 +22,39 @@ hlist_node = utils.CachedType("struct hlist_node")
def list_for_each(head):
if head.type == list_head.get_type().pointer():
head = head.dereference()
elif head.type != list_head.get_type():
- raise gdb.GdbError("Must be struct list_head not {}"
+ raise TypeError("Must be struct list_head not {}"
.format(head.type))
node = head['next'].dereference()
while node.address != head.address:
yield node.address
node = node['next'].dereference()
def list_for_each_entry(head, gdbtype, member):
for node in list_for_each(head):
- if node.type != list_head.get_type().pointer():
- raise TypeError("Type {} found. Expected struct list_head *."
- .format(node.type))
yield utils.container_of(node, gdbtype, member)
def hlist_for_each(head):
if head.type == hlist_head.get_type().pointer():
head = head.dereference()
elif head.type != hlist_head.get_type():
- raise gdb.GdbError("Must be struct hlist_head not {}"
+ raise TypeError("Must be struct hlist_head not {}"
.format(head.type))
node = head['first'].dereference()
while node.address:
yield node.address
node = node['next'].dereference()
def hlist_for_each_entry(head, gdbtype, member):
for node in hlist_for_each(head):
- if node.type != hlist_node.get_type().pointer():
- raise TypeError("Type {} found. Expected struct hlist_head *."
- .format(node.type))
yield utils.container_of(node, gdbtype, member)
def list_check(head):
nb = 0
--
2.17.1
Powered by blists - more mailing lists