netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Enrico Mioso <mrkiko.rs@gmail.com>,
	Christian Panton <christian@panton.org>,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	Oliver Neukum <oliver@neukum.org>,
	"David S. Miller" <davem@davemloft.net>,
	Porto Rio <porto.rio@gmx.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 4.4 27/56] cdc_ncm: Set NTB format again after altsetting switch for Huawei devices
Date: Wed, 15 Nov 2017 09:08:03 +0100	[thread overview]
Message-ID: <87efp00xss.fsf@miraculix.mork.no> (raw)
In-Reply-To: <1510705281.18523.53.camel@codethink.co.uk> (Ben Hutchings's message of "Wed, 15 Nov 2017 00:21:21 +0000")

Ben Hutchings <ben.hutchings@codethink.co.uk> writes:
> On Tue, 2017-07-11 at 17:21 +0200, Enrico Mioso wrote:
>> From: Enrico Mioso <mrkiko.rs@gmail.com>
>> 
>> commit 2b02c20ce0c28974b44e69a2e2f5ddc6a470ad6f upstream.
> [...]
>> --- a/drivers/net/usb/cdc_ncm.c
>> +++ b/drivers/net/usb/cdc_ncm.c
>> @@ -724,8 +724,10 @@ int cdc_ncm_bind_common(struct usbnet *d
>>  	u8 *buf;
>>  	int len;
>>  	int temp;
>> +	int err;
>> 	u8 iface_no;
>> 	struct usb_cdc_parsed_header hdr;
>> +	u16 curr_ntb_format;
> [...]
>> +		err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_FORMAT,
>> +				      USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
>> +				      0, iface_no, &curr_ntb_format, 2);
>> +		if (err < 0) {
>> +			goto error2;
>> +		}
>> +
>> +		if (curr_ntb_format == USB_CDC_NCM_NTB32_FORMAT) {
> [...]
>
> usbnet_read_cmd() doesn't do any byte-swapping, so it looks like
> curr_ntb_format will have little-endian byte order (__le16 not u16). 
> The comparison will then need to be done using
> le16_to_cpu(curr_ntb_format).

Right.  Thanks.  Fix coming up ASAP.

I cannot explain why since we are obviously reading and writing 2 bytes
here, but for some reason I've always thought of this value as 8 bit.


Bjørn

      reply	other threads:[~2017-11-15  8:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15  0:21 [PATCH 4.4 27/56] cdc_ncm: Set NTB format again after altsetting switch for Huawei devices Ben Hutchings
2017-11-15  8:08 ` Bjørn Mork [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efp00xss.fsf@miraculix.mork.no \
    --to=bjorn@mork.no \
    --cc=ben.hutchings@codethink.co.uk \
    --cc=christian@panton.org \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mrkiko.rs@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=oliver@neukum.org \
    --cc=porto.rio@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).