Commit cbb963de authored by Andy Shevchenko's avatar Andy Shevchenko Committed by David S. Miller

net/usb/kalmia: use %*phC to dump small buffers

Instead of dereferencing pointer and put values on stack we could use nice
%*phC specifier.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d6641ccf
...@@ -221,12 +221,9 @@ kalmia_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) ...@@ -221,12 +221,9 @@ kalmia_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
memset(skb_put(skb, padlen), 0, padlen); memset(skb_put(skb, padlen), 0, padlen);
} }
netdev_dbg( netdev_dbg(dev->net,
dev->net, "Sending package with length %i and padding %i. Header: %6phC.",
"Sending package with length %i and padding %i. Header: %02x:%02x:%02x:%02x:%02x:%02x.", content_len, padlen, header_start);
content_len, padlen, header_start[0], header_start[1],
header_start[2], header_start[3], header_start[4],
header_start[5]);
return skb; return skb;
} }
...@@ -263,32 +260,23 @@ kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb) ...@@ -263,32 +260,23 @@ kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
sizeof(EXPECTED_UNKNOWN_HEADER_1)) || !memcmp( sizeof(EXPECTED_UNKNOWN_HEADER_1)) || !memcmp(
header_start, EXPECTED_UNKNOWN_HEADER_2, header_start, EXPECTED_UNKNOWN_HEADER_2,
sizeof(EXPECTED_UNKNOWN_HEADER_2))) { sizeof(EXPECTED_UNKNOWN_HEADER_2))) {
netdev_dbg( netdev_dbg(dev->net,
dev->net, "Received expected unknown frame header: %6phC. Package length: %i\n",
"Received expected unknown frame header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n", header_start,
header_start[0], header_start[1],
header_start[2], header_start[3],
header_start[4], header_start[5],
skb->len - KALMIA_HEADER_LENGTH); skb->len - KALMIA_HEADER_LENGTH);
} }
else { else {
netdev_err( netdev_err(dev->net,
dev->net, "Received unknown frame header: %6phC. Package length: %i\n",
"Received unknown frame header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n", header_start,
header_start[0], header_start[1],
header_start[2], header_start[3],
header_start[4], header_start[5],
skb->len - KALMIA_HEADER_LENGTH); skb->len - KALMIA_HEADER_LENGTH);
return 0; return 0;
} }
} }
else else
netdev_dbg( netdev_dbg(dev->net,
dev->net, "Received header: %6phC. Package length: %i\n",
"Received header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n", header_start, skb->len - KALMIA_HEADER_LENGTH);
header_start[0], header_start[1], header_start[2],
header_start[3], header_start[4], header_start[5],
skb->len - KALMIA_HEADER_LENGTH);
/* subtract start header and end header */ /* subtract start header and end header */
usb_packet_length = skb->len - (2 * KALMIA_HEADER_LENGTH); usb_packet_length = skb->len - (2 * KALMIA_HEADER_LENGTH);
...@@ -310,12 +298,9 @@ kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb) ...@@ -310,12 +298,9 @@ kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
sizeof(HEADER_END_OF_USB_PACKET)) == 0); sizeof(HEADER_END_OF_USB_PACKET)) == 0);
if (!is_last) { if (!is_last) {
header_start = skb->data + ether_packet_length; header_start = skb->data + ether_packet_length;
netdev_dbg( netdev_dbg(dev->net,
dev->net, "End header: %6phC. Package length: %i\n",
"End header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n", header_start,
header_start[0], header_start[1],
header_start[2], header_start[3],
header_start[4], header_start[5],
skb->len - KALMIA_HEADER_LENGTH); skb->len - KALMIA_HEADER_LENGTH);
} }
} }
......
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