serial: core: Replace strncmp()+strlen() with plain strcmp()
PATCH 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().
--- drivers/tty/serial/serial_base_bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/tty/serial/serial_base_bus.c +1 -3
@@ -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 = {
Signature · 1 line
2.40.0.1.gaa8946217a0b
Quoted 3 lines · Andy Shevchenko
There is no sense to call
strlen()ahead ofstrncmp(). The same effect can be achieved by callingstrcmp()directly. Replace strncmp()+strlen() with plainstrcmp().
It seems I will have more against serial core, perhaps it makes sense to unite them in a single series.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 7 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
There is no sense to call
strlen()ahead ofstrncmp(). The same effect can be achieved by callingstrcmp()directly. Replace strncmp()+strlen() with plainstrcmp().It seems I will have more against serial core, perhaps it makes sense to unite them in a single series.
Actually this change is simply wrong. Sorry for the noise.
Signature · 2 lines
With Best Regards, Andy Shevchenko