From mboxrd@z Thu Jan 1 00:00:00 1970 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 44F0BC433F5 for ; Fri, 20 May 2022 11:41:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236544AbiETLlq (ORCPT ); Fri, 20 May 2022 07:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236511AbiETLlp (ORCPT ); Fri, 20 May 2022 07:41:45 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF22E27FF9 for ; Fri, 20 May 2022 04:41:39 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id bq30so13883195lfb.3 for ; Fri, 20 May 2022 04:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=5jC48Ht+Bcyme4Q7fEnWzFy8YbanLkE++0WXdYNkUu4=; b=ZoKgeB5FjwyDJ75wjq4ksZf9hKTd50hwZnEqNvTHYsaD5jWzg7FC8c0LAWWTIzy/NP LafKvOr7q4axNuz1/LBQvKY/ZxQAqjYegtJQskJZ8HAXX7wrQOtIrF9oa520cm/lQ2sy Pe0uMM0Rf7aY2sx9WnOoLDtK/J4ZsUANi+aUKi0GZNyCsS9x8BYQzckSq2F8OQv440t2 JVZFP7njEw4vxM6EkIjLd1Mv+D+fxAxCYtalNvj+3NhbCu9ulXuaop1Hhsbizisii8tF aZBY+NAjTMy/R0Lmy9IDqRGKDtP8lwxLx4KPH89g7Z4B5oU0tNgL1uadKZW7x1P929oU GC9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=5jC48Ht+Bcyme4Q7fEnWzFy8YbanLkE++0WXdYNkUu4=; b=bVA2MpXbV/xRgFf6Se18EUA0GsR7sE2xxWmDH1SnFhAwY5PJkvRogW1pCxStCxyaij eaB0oWeMnU5AileoZGdzoEgnSEH6HlSmVooqgJViXwfBy9CQflqdwYGGsWQPwF422dV0 zMgBqjN9F/AkaB18nrpWS9srmkmVj9GwSEl/dRvXbD0eO47bta1GCMiGZ12NTkDdZmmS 6r7y9QwtlqYYqjmvX1sT8WdJLeiYWb3lNPKjFag4DmErne+Wn066dDfopMxXII5Pufrk hLx0Ivzz9iDSm4U01RfV4v1QowhcitF5TpN0BJGeNDuhzgBHuzsT2MbJ2lA+rIPsjaQe 9Pgw== X-Gm-Message-State: AOAM533TdPnap9V08bRye0R4UmHoy/PVBzhpqOwL5QsmmuSBZYsQTiGG X1C2VlA35E7kqcHeCabyhSWq4g== X-Google-Smtp-Source: ABdhPJwiNxvzF9ggZuaPT1v3jo3hAgqnvSiiwWt+/3HYd82G69B7oqELDm0x9dVgJhTLOYzdOZ0eYA== X-Received: by 2002:a05:6512:2146:b0:477:c619:ec2d with SMTP id s6-20020a056512214600b00477c619ec2dmr6044077lfr.179.1653046898235; Fri, 20 May 2022 04:41:38 -0700 (PDT) Received: from [192.168.0.17] (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id a9-20020a2e9809000000b0024f3d1daeebsm283070ljj.115.2022.05.20.04.41.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 May 2022 04:41:37 -0700 (PDT) Message-ID: Date: Fri, 20 May 2022 13:41:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH 7/8] hwmon: (lm90) read the channel's label from device-tree Content-Language: en-US To: Slawomir Stepien Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, jdelvare@suse.com, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, przemyslaw.cencner@nokia.com, krzysztof.adamski@nokia.com, alexander.sverdlin@nokia.com, Slawomir Stepien References: <20220520093243.2523749-1-sst@poczta.fm> <20220520093243.2523749-8-sst@poczta.fm> From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 20/05/2022 13:01, Slawomir Stepien wrote: >>> +static int lm90_probe_channel_from_dt(struct i2c_client *client, >>> + struct device_node *child, >>> + struct lm90_data *data) >>> +{ >>> + u32 id; >>> + int err; >>> + struct device *dev = &client->dev; >>> + >>> + err = of_property_read_u32(child, "reg", &id); >>> + if (err) { >>> + dev_err(dev, "missing reg property of %pOFn\n", child); >>> + return err; >>> + } >>> + >>> + if (id >= MAX_CHANNELS) { >>> + dev_err(dev, "invalid reg %d in %pOFn\n", id, child); >>> + return -EINVAL; >>> + } >>> + >>> + err = of_property_read_string(child, "label", &data->channel_label[id]); >>> + if (err == -ENODATA || err == -EILSEQ) { >>> + dev_err(dev, "invalid label in %pOFn\n", child); >> >> You did not make it a required property, so why failing? > > But if you have it in device-tree, then at least inform the user that there is some problem with it. Hm, true, the missing property would return EINVAL. Sounds good then. x Best regards, Krzysztof