Commit 6607d1a4 authored by Maciej Żenczykowski's avatar Maciej Żenczykowski Committed by Greg Kroah-Hartman
Browse files

usb: gadget: f_ncm: ncm_wrap_ntb - move var definitions into if statement



Since they're only used if there's an skb.

Cc: Brooke Basile <brookebasile@gmail.com>
Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
Link: https://lore.kernel.org/r/20210701114834.884597-5-zenczykowski@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b88668fe
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -1013,6 +1013,8 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port,
{
	struct f_ncm	*ncm = func_to_ncm(&port->func);
	struct sk_buff	*skb2 = NULL;

	if (skb) {
		int		ncb_len = 0;
		__le16		*ntb_data;
		__le16		*ntb_ndp;
@@ -1025,7 +1027,6 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port,
		const int rem = le16_to_cpu(ntb_parameters.wNdpInPayloadRemainder);
		const int dgram_idx_len = 2 * 2 * opts->dgram_item_len;

	if (skb) {
		/* Add the CRC if required up front */
		if (ncm->is_crc) {
			uint32_t	crc;