summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/greybus_trace.h
diff options
context:
space:
mode:
authorDavid Lin <dtwlin@google.com>2016-03-18 18:30:50 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2016-03-22 00:31:31 -0400
commit30b442b385c199b3f8e1df26fd6f0c07b61b32a2 (patch)
tree436da730c924e4531c4a08174fa8681c0199ff56 /drivers/staging/greybus/greybus_trace.h
parent309520ec93f7190c0c3d22d613825a0835a8600f (diff)
downloadlinux-30b442b385c199b3f8e1df26fd6f0c07b61b32a2.tar.bz2
greybus: greybus_trace: Fix broken greybus ftrace
Enabling greybus ftrace event causes null pointer access due to that gb_message to SVC has no Bundle. Fix it by handling this in the trace header. Testing Done: $ echo 1 > /d/tracing/event/greybus/enable [002] ...1 54.504426: gb_message_send: greybus:1-svc op=0023 if_id=0 hd_id=0 l=0 [002] ...1 54.504461: gb_host_device_send: greybus:greybus1 if_id=0 l=8 Signed-off-by: David Lin <dtwlin@google.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/greybus_trace.h')
-rw-r--r--drivers/staging/greybus/greybus_trace.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/staging/greybus/greybus_trace.h b/drivers/staging/greybus/greybus_trace.h
index 96c515113b98..6f3e10164e3c 100644
--- a/drivers/staging/greybus/greybus_trace.h
+++ b/drivers/staging/greybus/greybus_trace.h
@@ -17,6 +17,11 @@
struct gb_message;
struct gb_host_device;
+#define gb_bundle_name(message) \
+ (message->operation->connection->bundle ? \
+ dev_name(&message->operation->connection->bundle->dev) : \
+ dev_name(&message->operation->connection->hd->svc->dev))
+
DECLARE_EVENT_CLASS(gb_message,
TP_PROTO(struct gb_message *message),
@@ -24,7 +29,7 @@ DECLARE_EVENT_CLASS(gb_message,
TP_ARGS(message),
TP_STRUCT__entry(
- __string(name, dev_name(&message->operation->connection->bundle->dev))
+ __string(name, gb_bundle_name(message))
__field(u16, op_id)
__field(u16, intf_cport_id)
__field(u16, hd_cport_id)
@@ -32,7 +37,7 @@ DECLARE_EVENT_CLASS(gb_message,
),
TP_fast_assign(
- __assign_str(name, dev_name(&message->operation->connection->bundle->dev))
+ __assign_str(name, gb_bundle_name(message))
__entry->op_id = message->operation->id;
__entry->intf_cport_id =
message->operation->connection->intf_cport_id;