From: Leonard Crestez <leonard.crestez@nxp.com>
To: Stephen Boyd <sboyd@kernel.org>,
Kieran Bingham <kbingham@kernel.org>,
Jan Kiszka <jan.kiszka@siemens.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michael Turquette <mturquette@baylibre.com>,
"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] scripts/gdb: Cleanup error handling in list helpers
Date: Fri, 3 May 2019 11:19:31 +0000 [thread overview]
Message-ID: <c1d3fd4db13d999a3ba57f5bbc1924862d824f61.1556881728.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1556881728.git.leonard.crestez@nxp.com>
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@nxp.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
next prev parent reply other threads:[~2019-05-03 11:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-03 11:19 [PATCH 0/2] gdb/scripts: Improve lx-clk-summary Leonard Crestez
2019-05-03 11:19 ` Leonard Crestez [this message]
2019-05-03 16:33 ` [PATCH 1/2] scripts/gdb: Cleanup error handling in list helpers Stephen Boyd
2019-05-03 11:19 ` [PATCH 2/2] scripts/gdb: Print cached rate in lx-clk-summary Leonard Crestez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c1d3fd4db13d999a3ba57f5bbc1924862d824f61.1556881728.git.leonard.crestez@nxp.com \
--to=leonard.crestez@nxp.com \
--cc=akpm@linux-foundation.org \
--cc=jan.kiszka@siemens.com \
--cc=kbingham@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®