summaryrefslogtreecommitdiffstats
path: root/net/tipc/bearer.c
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-10-07 11:31:49 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-12-27 11:13:06 -0500
commitc61b666e260d5cc2e0203b21c689321e6ab0d676 (patch)
tree3099d9f46c035b36c7555e75221df44f79f477a3 /net/tipc/bearer.c
parent6c349210101352103d9055636845155bc801ae9b (diff)
downloadlinux-c61b666e260d5cc2e0203b21c689321e6ab0d676.tar.bz2
tipc: Improve handling of media address printing errors
Enhances conversion of a media address to printable form so that an unconvertable address will be displayed as a string of hex digits, rather than not being displayed at all. (Also removes a pointless check for the existence of the media-specific address conversion routine, since the routine is not optional.) Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/bearer.c')
-rw-r--r--net/tipc/bearer.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index f908b804a968..17652f20a359 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -136,20 +136,18 @@ exit:
void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
{
+ char addr_str[MAX_ADDR_STR];
struct media *m_ptr;
u32 media_type;
- u32 i;
media_type = ntohl(a->type);
m_ptr = media_find_id(media_type);
- if (m_ptr && (m_ptr->addr2str != NULL)) {
- char addr_str[MAX_ADDR_STR];
-
- tipc_printf(pb, "%s(%s)", m_ptr->name,
- m_ptr->addr2str(a, addr_str, sizeof(addr_str)));
- } else {
+ if (m_ptr && !m_ptr->addr2str(a, addr_str, sizeof(addr_str)))
+ tipc_printf(pb, "%s(%s)", m_ptr->name, addr_str);
+ else {
unchar *addr = (unchar *)&a->dev_addr;
+ u32 i;
tipc_printf(pb, "UNKNOWN(%u)", media_type);
for (i = 0; i < (sizeof(*a) - sizeof(a->type)); i++)