From patchwork Thu Jul 27 09:05:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 707470 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7D81C001DC for ; Thu, 27 Jul 2023 09:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232664AbjG0JOY (ORCPT ); Thu, 27 Jul 2023 05:14:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234677AbjG0JN0 (ORCPT ); Thu, 27 Jul 2023 05:13:26 -0400 Received: from mgamail.intel.com (unknown [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D114B449A; Thu, 27 Jul 2023 02:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690448704; x=1721984704; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=T+ltj6/n0zItDURuD6zDq9RQiKC3xwEfEl0V4qLQniA=; b=ip1Ud8RXkfTLVAGOPqQ7Qi4pVLbS09NzArxcaf0r7ZaN6qOOctFr8+Rh RLggmbWIFzWB1Ahly9vth/JcGlOglWf1mfAV9nbTcv1szzM1XuvzOLEjm 4z9yMsaY4VsmDh1/OVI2x+TUeBW8+aQhpa/Z3qrcRR3motIwUjbW08unb zrhyvRPsOxR8frR1D/NXb2FCf1nRBAxa9+Lbw1hsztRaULLv01xgykmG/ 9Mwl0kziqF+g4+nOYPOgkNeKE8ejIkjjJxYQDBNEzhBFr4x818D/PCiOy DDSWvdnIayEjvo/6mcrbpOJz2eHWZ7BgbJzcZA5rSw060JoLg8gGK0Vwz g==; X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="365716691" X-IronPort-AV: E=Sophos;i="6.01,234,1684825200"; d="scan'208";a="365716691" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 02:05:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="1057645029" X-IronPort-AV: E=Sophos;i="6.01,234,1684825200"; d="scan'208";a="1057645029" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 27 Jul 2023 02:05:02 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9195724F; Thu, 27 Jul 2023 12:05:11 +0300 (EEST) From: Andy Shevchenko To: Greg Kroah-Hartman , Tony Lindgren , Dan Carpenter , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Jiri Slaby , Andy Shevchenko Subject: [PATCH v1 1/1] serial: core: Replace strncmp()+strlen() with plain strcmp() Date: Thu, 27 Jul 2023 12:05:07 +0300 Message-Id: <20230727090507.81962-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 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 --- 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 = {