diff options
author | Maciej Żenczykowski <maze@google.com> | 2021-07-01 04:48:33 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-21 10:04:19 +0200 |
commit | 6607d1a4c3c946d3420d33d1b561d7bee8f693c9 (patch) | |
tree | cf380b6ceaba0983fbae2992e73acbd2d02d4cf3 /drivers/usb/gadget/function/f_ncm.c | |
parent | b88668fec959fec0e77196455ec82778d8065941 (diff) | |
download | linux-stable-6607d1a4c3c946d3420d33d1b561d7bee8f693c9.tar.gz linux-stable-6607d1a4c3c946d3420d33d1b561d7bee8f693c9.tar.bz2 linux-stable-6607d1a4c3c946d3420d33d1b561d7bee8f693c9.zip |
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: Maciej Żenczykowski <maze@google.com>
Link: https://lore.kernel.org/r/20210701114834.884597-5-zenczykowski@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/function/f_ncm.c')
-rw-r--r-- | drivers/usb/gadget/function/f_ncm.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index cab17ae4fa34..dc8f078f918c 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c @@ -1013,19 +1013,20 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port, { struct f_ncm *ncm = func_to_ncm(&port->func); struct sk_buff *skb2 = NULL; - int ncb_len = 0; - __le16 *ntb_data; - __le16 *ntb_ndp; - int dgram_pad; - - unsigned max_size = ncm->port.fixed_in_len; - const struct ndp_parser_opts *opts = ncm->parser_opts; - const int ndp_align = le16_to_cpu(ntb_parameters.wNdpInAlignment); - const int div = le16_to_cpu(ntb_parameters.wNdpInDivisor); - const int rem = le16_to_cpu(ntb_parameters.wNdpInPayloadRemainder); - const int dgram_idx_len = 2 * 2 * opts->dgram_item_len; if (skb) { + int ncb_len = 0; + __le16 *ntb_data; + __le16 *ntb_ndp; + int dgram_pad; + + unsigned max_size = ncm->port.fixed_in_len; + const struct ndp_parser_opts *opts = ncm->parser_opts; + const int ndp_align = le16_to_cpu(ntb_parameters.wNdpInAlignment); + const int div = le16_to_cpu(ntb_parameters.wNdpInDivisor); + const int rem = le16_to_cpu(ntb_parameters.wNdpInPayloadRemainder); + const int dgram_idx_len = 2 * 2 * opts->dgram_item_len; + /* Add the CRC if required up front */ if (ncm->is_crc) { uint32_t crc; |