Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755296AbcJZIus (ORCPT ); Wed, 26 Oct 2016 04:50:48 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:38260 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753890AbcJZIun (ORCPT ); Wed, 26 Oct 2016 04:50:43 -0400 Date: Wed, 26 Oct 2016 09:53:16 +0100 From: Lee Jones To: Kieran Bingham Cc: Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Martinez Canillas , sameo@linux.intel.com Subject: Re: [PATCHv6 08/11] i2c: match vendorless strings on the internal string length Message-ID: <20161026085316.GK8574@dell> References: <1477413715-22894-1-git-send-email-kieran@bingham.xyz> <1477413715-22894-9-git-send-email-kieran@bingham.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1477413715-22894-9-git-send-email-kieran@bingham.xyz> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1116 Lines: 38 On Tue, 25 Oct 2016, Kieran Bingham wrote: > If a user provides a shortened string to match a device to the sysfs i2c > interface it will match on the first string that contains that string > prefix. > > for example: > echo a 0x68 > /sys/bus/i2c/devices/i2c-2/new_device > > will match as3711, as3722, and ak8975 incorrectly. > > Signed-off-by: Kieran Bingham Acked-by: Lee Jones > --- > drivers/i2c/i2c-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c > index 01bce56f733a..50c9cfdb87b7 100644 > --- a/drivers/i2c/i2c-core.c > +++ b/drivers/i2c/i2c-core.c > @@ -1708,7 +1708,7 @@ i2c_of_match_device_strip_vendor(const struct of_device_id *matches, > else > name++; > > - if (!strncasecmp(client->name, name, strlen(client->name))) > + if (!strncasecmp(client->name, name, strlen(name))) > return matches; > } > -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog