From: kbuild test robot <lkp@intel.com>
To: Lauri Jakku <lja@iki.fi>
Cc: kbuild-all@lists.01.org, oneukum@suse.com,
benjamin.tissoires@redhat.com, jikos@kernel.org,
linux-input@vger.kernel.org, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, Lauri Jakku <lja@iki.fi>
Subject: Re: [PATCH v3] USB: HID: random timeout failures tackle try.
Date: Wed, 5 Feb 2020 00:52:14 +0800 [thread overview]
Message-ID: <202002050024.VCurREwg%lkp@intel.com> (raw)
In-Reply-To: <20200204131555.25534-1-lja@iki.fi>
[-- Attachment #1: Type: text/plain, Size: 4857 bytes --]
Hi Lauri,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v5.5 next-20200204]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Lauri-Jakku/USB-HID-random-timeout-failures-tackle-try/20200204-232348
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/usb/core/message.c: In function 'usb_control_msg':
>> drivers/usb/core/message.c:173:11: error: type defaults to 'int' in declaration of 'timeout_happened' [-Werror=implicit-int]
static timeout_happened = 0;
^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +173 drivers/usb/core/message.c
108
109 /**
110 * usb_control_msg - Builds a control urb, sends it off and waits for completion
111 * @dev: pointer to the usb device to send the message to
112 * @pipe: endpoint "pipe" to send the message to
113 * @request: USB message request value
114 * @requesttype: USB message request type value
115 * @value: USB message value
116 * @index: USB message index value
117 * @data: pointer to the data to send
118 * @size: length in bytes of the data to send
119 * @timeout: time in msecs to wait for the message to complete before timing
120 * out (if 0 the wait is forever)
121 *
122 * Context: !in_interrupt ()
123 *
124 * This function sends a simple control message to a specified endpoint and
125 * waits for the message to complete, or timeout.
126 *
127 * Don't use this function from within an interrupt context. If you need
128 * an asynchronous message, or need to send a message from within interrupt
129 * context, use usb_submit_urb(). If a thread in your driver uses this call,
130 * make sure your disconnect() method can wait for it to complete. Since you
131 * don't have a handle on the URB used, you can't cancel the request.
132 *
133 * Return: If successful, the number of bytes transferred. Otherwise, a negative
134 * error number.
135 */
136 int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request,
137 __u8 requesttype, __u16 value, __u16 index, void *data,
138 __u16 size, int timeout)
139 {
140 struct usb_ctrlrequest *dr;
141 int ret = -ETIMEDOUT;
142
143 /* retry_cnt * 20ms, max retry time set to 400ms */
144 int retry_cnt = 20;
145
146 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
147 if (!dr)
148 return -ENOMEM;
149
150 dr->bRequestType = requesttype;
151 dr->bRequest = request;
152 dr->wValue = cpu_to_le16(value);
153 dr->wIndex = cpu_to_le16(index);
154 dr->wLength = cpu_to_le16(size);
155
156 do {
157 ret = usb_internal_control_msg(dev,
158 pipe,
159 dr,
160 data,
161 size,
162 timeout);
163
164 /*
165 * Linger a bit, prior to the next control message
166 * or if return value is timeout, but do try few
167 * times (max 400ms) before quitting. Adapt timeout
168 * to be smaller when we have timeout'd first time.
169 */
170 if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG)
171 msleep(200);
172 else if (ret == -ETIMEDOUT) {
> 173 static timeout_happened = 0;
174
175 if ( ! timeout_happened ) {
176 timeout_happened = 1;
177
178 /*
179 * If timeout is given, divide it
180 * by 100, if not, put 10ms timeout.
181 *
182 * Then safeguard: if timeout is under
183 * 10ms, make timeout to be 10ms.
184 */
185
186 if (timeout > 0)
187 timeout /= 100;
188 else
189 timeout = 10;
190
191 if (timeout < 10)
192 timeout = 10;
193
194 }
195
196 msleep(20);
197 }
198
199 /* Loop while timeout, max loops: retry_cnt times. */
200 } while ((retry_cnt-- > 0) && (ret == -ETIMEDOUT));
201
202
203 kfree(dr);
204
205 return ret;
206 }
207 EXPORT_SYMBOL_GPL(usb_control_msg);
208
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28831 bytes --]
prev parent reply other threads:[~2020-02-04 16:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 13:15 [PATCH v3] USB: HID: random timeout failures tackle try Lauri Jakku
2020-02-04 13:53 ` Greg KH
2020-02-04 16:52 ` kbuild test robot [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=202002050024.VCurREwg%lkp@intel.com \
--to=lkp@intel.com \
--cc=benjamin.tissoires@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jikos@kernel.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lja@iki.fi \
--cc=oneukum@suse.com \
/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).