[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230727090507.81962-1-andriy.shevchenko@linux.intel.com>
Date: Thu, 27 Jul 2023 12:05:07 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Tony Lindgren <tony@...mide.com>,
Dan Carpenter <dan.carpenter@...aro.org>,
linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org
Cc: Jiri Slaby <jirislaby@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v1 1/1] serial: core: Replace strncmp()+strlen() with plain strcmp()
There is no sense to call strlen() ahead of strncmp().
The same effect can be achieved by calling strcmp() directly.
Replace strncmp()+strlen() with plain strcmp().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/tty/serial/serial_base_bus.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c
index 6ff59c89d867..bd056e6dca2f 100644
--- a/drivers/tty/serial/serial_base_bus.c
+++ b/drivers/tty/serial/serial_base_bus.c
@@ -21,9 +21,7 @@ static bool serial_base_initialized;
static int serial_base_match(struct device *dev, struct device_driver *drv)
{
- int len = strlen(drv->name);
-
- return !strncmp(dev_name(dev), drv->name, len);
+ return !strcmp(dev_name(dev), drv->name);
}
static struct bus_type serial_base_bus_type = {
--
2.40.0.1.gaa8946217a0b
Powered by blists - more mailing lists