From: "Uwe Kleine-König" <uwe@kleine-koenig.org>
To: Johan Hovold <johan@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 1/2] USB: serial: Drop if with an always false condition
Date: Mon, 8 Feb 2021 15:31:48 +0100 [thread overview]
Message-ID: <20210208143149.963644-1-uwe@kleine-koenig.org> (raw)
In a bus remove function the passed device is always valid, so there is
no need to check for it being NULL.
(Side note: The check for port being non-NULL is broken anyhow, because
to_usb_serial_port() is a wrapper around container_of() for a member that is
not the first one. So port can hardly become NULL.)
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
drivers/usb/serial/bus.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index eb0195cf37dd..d862ed656414 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -87,15 +87,11 @@ static int usb_serial_device_probe(struct device *dev)
static int usb_serial_device_remove(struct device *dev)
{
struct usb_serial_driver *driver;
- struct usb_serial_port *port;
+ struct usb_serial_port *port = to_usb_serial_port(dev);
int retval = 0;
int minor;
int autopm_err;
- port = to_usb_serial_port(dev);
- if (!port)
- return -ENODEV;
-
/*
* Make sure suspend/resume doesn't race against port_remove.
*
base-commit: 5c8fe583cce542aa0b84adc939ce85293de36e5e
--
2.29.2
next reply other threads:[~2021-02-08 14:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-08 14:31 Uwe Kleine-König [this message]
2021-02-08 14:31 ` [PATCH v1 2/2] USB: serial: Make remove callback return void Uwe Kleine-König
2021-02-08 15:28 ` [PATCH v1 1/2] USB: serial: Drop if with an always false condition Johan Hovold
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=20210208143149.963644-1-uwe@kleine-koenig.org \
--to=uwe@kleine-koenig.org \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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).