From: Robert Greener <rob@robgreener.com>
To: unlisted-recipients:; (no To-header on input)
Subject: [PATCH 12/13] usb: core: config: remove multiple assignments
Date: Tue, 5 Oct 2021 14:43:08 +0100 [thread overview]
Message-ID: <af1fb8e9de157431a5a912f7a03f6ff70d4263cd.1633442131.git.rob@robgreener.com> (raw)
In-Reply-To: <cover.1633442131.git.rob@robgreener.com>
This fixes the following checkpatch.pl warning at multiple locations:
CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided
Signed-off-by: Robert Greener <rob@robgreener.com>
---
drivers/usb/core/config.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index ab3395ec4260..1fe995a66182 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -342,7 +342,8 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
*/
if (udev->quirks & USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL) {
n = clamp(fls(d->bInterval) + 3, i, j);
- i = j = n;
+ j = n;
+ i = j;
}
/*
* This quirk fixes bIntervals reported in
@@ -350,7 +351,8 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
*/
if (udev->quirks & USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL) {
n = clamp(fls(d->bInterval), i, j);
- i = j = n;
+ j = n;
+ i = j;
}
break;
default: /* USB_SPEED_FULL or _LOW */
@@ -554,7 +556,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno,
size -= i;
/* Allocate space for the right(?) number of endpoints */
- num_ep = num_ep_orig = alt->desc.bNumEndpoints;
+ num_ep_orig = alt->desc.bNumEndpoints;
+ num_ep = num_ep_orig;
alt->desc.bNumEndpoints = 0; /* Use as a counter */
if (num_ep > USB_MAXENDPOINTS) {
dev_warn(ddev,
@@ -616,7 +619,8 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx,
unsigned int iad_num = 0;
memcpy(&config->desc, buffer, USB_DT_CONFIG_SIZE);
- nintf = nintf_orig = config->desc.bNumInterfaces;
+ nintf_orig = config->desc.bNumInterfaces;
+ nintf = nintf_orig;
config->desc.bNumInterfaces = 0; // Adjusted later
if (config->desc.bDescriptorType != USB_DT_CONFIG ||
@@ -741,7 +745,8 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx,
cfgno, n, plural(n), nintf_orig);
else if (n == 0)
dev_warn(ddev, "config %d has no interfaces?\n", cfgno);
- config->desc.bNumInterfaces = nintf = n;
+ nintf = n;
+ config->desc.bNumInterfaces = nintf;
/* Check for missing interface numbers */
for (i = 0; i < nintf; ++i) {
@@ -762,7 +767,8 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx,
dev_warn(ddev,
"too many alternate settings for config %d interface %d: %d, using maximum allowed: %d\n",
cfgno, inums[i], j, USB_MAXALTSETTING);
- nalts[i] = j = USB_MAXALTSETTING;
+ j = USB_MAXALTSETTING;
+ nalts[i] = j;
}
intfc = kzalloc(struct_size(intfc, altsetting, j), GFP_KERNEL);
@@ -867,7 +873,8 @@ int usb_get_configuration(struct usb_device *dev)
dev_warn(ddev,
"too many configurations: %d, using maximum allowed: %d\n",
ncfg, USB_MAXCONFIG);
- dev->descriptor.bNumConfigurations = ncfg = USB_MAXCONFIG;
+ ncfg = USB_MAXCONFIG;
+ dev->descriptor.bNumConfigurations = ncfg;
}
if (ncfg < 1) {
--
2.32.0
next prev parent reply other threads:[~2021-10-05 14:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 13:55 [PATCH 00/13] usb: core: config: fix all checkpatch.pl warnings Robert Greener
2021-10-05 12:22 ` [PATCH 01/13] usb: core: config: Use tabs rather than spaces for new lines of args Robert Greener
2021-10-05 14:59 ` Joe Perches
2021-10-05 12:31 ` [PATCH 02/13] usb: core: config: fix block comment styles Robert Greener
2021-10-05 12:35 ` [PATCH 03/13] usb: core: config: Change `unsigned` to `unsigned int` Robert Greener
2021-10-05 12:37 ` [PATCH 04/13] usb: core: config: Avoid multiple line derefrence Robert Greener
2021-10-05 12:41 ` [PATCH 05/13] usb: core: config: Fix typo in dev_warn Robert Greener
2021-10-05 13:22 ` [PATCH 06/13] usb: core: config: unsplit strings which are split across lines Robert Greener
2021-10-05 13:25 ` [PATCH 07/13] usb: core: config: remove unnecessary blank lines Robert Greener
2021-10-05 13:26 ` [PATCH 08/13] usb: core: config: add blank lines after struct def Robert Greener
2021-10-05 13:30 ` [PATCH 09/13] usb: core: config: fix inline spacign Robert Greener
2021-10-05 13:34 ` [PATCH 10/13] usb: core: config: fix checkpatch.pl braces warning Robert Greener
2021-10-05 13:37 ` [PATCH 11/13] usb: core: config: remove unnecessary parentheses Robert Greener
2021-10-05 13:43 ` Robert Greener [this message]
2021-10-05 13:52 ` [PATCH 13/13] usb: core: config: fix parenthesis alignment Robert Greener
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=af1fb8e9de157431a5a912f7a03f6ff70d4263cd.1633442131.git.rob@robgreener.com \
--to=rob@robgreener.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).