From patchwork Thu Mar 21 17:35:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 2316031 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 4AB0240213 for ; Thu, 21 Mar 2013 17:37:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751791Ab3CURhC (ORCPT ); Thu, 21 Mar 2013 13:37:02 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:45274 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751694Ab3CURhB (ORCPT ); Thu, 21 Mar 2013 13:37:01 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2LHaWkg013618; Thu, 21 Mar 2013 12:36:32 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2LHaWOP025986; Thu, 21 Mar 2013 12:36:32 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Thu, 21 Mar 2013 12:36:32 -0500 Received: from localhost.localdomain (h79-1.vpn.ti.com [172.24.79.1]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2LHaGek025896; Thu, 21 Mar 2013 12:36:31 -0500 From: Tero Kristo To: , , , CC: , Mike Turquette Subject: [RFC 7/8] clk: use strncmp for matching con_id in clk_find Date: Thu, 21 Mar 2013 19:35:46 +0200 Message-ID: <1363887347-4686-8-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1363887347-4686-1-git-send-email-t-kristo@ti.com> References: <1363887347-4686-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org As clkdev register forces the con_id length down to a maximum of 15 characters and terminating null, replace the internal implementation of clk_find to use strncmp instead of strcmp. This makes sure that if a user registers a clkdev with con_id name which gets trimmed, the same string used in the clk_lookup will still succeed despite this. Signed-off-by: Tero Kristo Cc: Mike Turquette --- drivers/clk/clkdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 442a313..05b01a1 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -120,7 +120,7 @@ static struct clk_lookup *clk_find(const char *dev_id, const char *con_id) match += 2; } if (p->con_id) { - if (!con_id || strcmp(p->con_id, con_id)) + if (!con_id || strncmp(p->con_id, con_id, 15)) continue; match += 1; }