From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752667AbbHZX0J (ORCPT ); Wed, 26 Aug 2015 19:26:09 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:59550 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751415AbbHZX0H (ORCPT ); Wed, 26 Aug 2015 19:26:07 -0400 Message-ID: <55DE4B07.503@roeck-us.net> Date: Wed, 26 Aug 2015 16:25:59 -0700 From: Guenter Roeck User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: "Rafael J. Wysocki" CC: Greg Kroah-Hartman , Steve Glendinning , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "Rafael J. Wysocki" , Jeremy Linton , tony@atomide.com Subject: Re: [PATCH -next v2 1/2] device property: Return -ENXIO if there is no suitable FW interface References: <1440620445-14413-1-git-send-email-linux@roeck-us.net> <3249742.BGnB0hq1eB@vostro.rjw.lan> In-Reply-To: <3249742.BGnB0hq1eB@vostro.rjw.lan> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated_sender: linux@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/26/2015 04:37 PM, Rafael J. Wysocki wrote: > On Wednesday, August 26, 2015 01:20:44 PM Guenter Roeck wrote: >> Return -ENXIO if device property array access functions don't find >> a suitable firmware interface. >> >> This lets drivers decide if they should use available platform data >> instead. >> >> Cc: Rafael J. Wysocki >> Signed-off-by: Guenter Roeck >> --- >> v2: Added patch >> >> drivers/base/property.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/drivers/base/property.c b/drivers/base/property.c >> index 287704d680bf..9600b824d138 100644 >> --- a/drivers/base/property.c >> +++ b/drivers/base/property.c >> @@ -69,6 +69,9 @@ static int pset_prop_read_array(struct property_set *pset, const char *name, >> struct property_entry *prop; >> unsigned int item_size; >> >> + if (!pset) >> + return -ENXIO; >> + > > This isn't exactly straightforward, because it relies on the fact that > pset_prop_read_array() is the last thing tried by FWNODE_PROP_READ_ARRAY() > and fwnode_property_read_string_array(). A comment about that might be > helpful. > I see two options: Add a comment above, or change the calling code to ... else if (is_pset(fwnode)) return pset_prop_read_array(to_pset(fwnode), propname, DEV_PROP_STRING, val, nval); return -ENXIO; which would make it obvious and avoid side effects if the code is changed later on. Would you be ok with this ? Thanks, Guenter