From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932863AbbIXHZO (ORCPT ); Thu, 24 Sep 2015 03:25:14 -0400 Received: from 7of9.schinagl.nl ([88.159.158.68]:54616 "EHLO 7of9.schinagl.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932725AbbIXHZL (ORCPT ); Thu, 24 Sep 2015 03:25:11 -0400 Message-ID: <5603A552.9020005@schinagl.nl> Date: Thu, 24 Sep 2015 09:25:06 +0200 From: Olliver Schinagl User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Mika Westerberg , Linus Walleij , Grant Likely , "Rafael J. Wysocki" , Alexandre Courbot CC: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: gpios search behaviour for gpio from _DSD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey list, Mika, With commit 0d9a693cc86 the following snippet of code was added: + /* Try first from _DSD */ + for (i = 0; i < ARRAY_SIZE(suffixes); i++) { + if (con_id && strcmp(con_id, "gpios")) { + snprintf(propname, sizeof(propname), "%s-%s", + con_id, suffixes[i]); and I was wondering why the gpios suffix is singled out. Are we not allowed to check for all the strings in the suffixes array? Is gpios special or is gpio simply not allowed. If that strcmp check would be removed, would bad things happen? Also, just to educate myself, isn't relying on left to right parsing complier specifc? E.g. if con_id is null, we end up passing NULL to strcmp and atleast for libc can cause segfaults iirc. Thanks, Olliver