Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp937904rwl; Thu, 5 Jan 2023 06:40:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXtD3Y2F5VlE9O85QJCGi51mpHScKXzJLlOZ0XQfdBt3vYo8VpCHD7edfPeXrWz1+yA70EmF X-Received: by 2002:a17:902:ee44:b0:192:6262:d615 with SMTP id 4-20020a170902ee4400b001926262d615mr49564898plo.19.1672929657720; Thu, 05 Jan 2023 06:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672929657; cv=none; d=google.com; s=arc-20160816; b=IkOvQLbK0ufOndN1/fnrcUXv+zQyQySh3ZonAZ97CGCeZOzImbNIXfeevvhOeB+dbn FTJ1qDZDhDE2pwQxaXmYpvgjNWMKjipSfdmsed5u591ZH1rGZjgEL45vTbmINa36W7ng SEiWKAnu/kcYC57jFzBdoObzoNa3VbWmimHiVTQqgEGy4P70lI/Ra7M7vc3xB8hL4bwt 40dGmCHgPZ8xXFnapvrEYSV+vViWYDqTN/MdvW8Yju0cVKJCo1NRS0Ztl734QGN/YvPK DI5YLRIpmlF0TA9rMZYWfPuE4KbcNKZoysuKZtv4hPjIPPc0QwX4FwzmXAks4jaDf8Np 5YJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature; bh=5NSOtoeMbNg7K9lSDnR+3y2JY7MECEcqj20jo+eSw7k=; b=QoRd6aGhlNqC7ZgSUk0eA1KbPk88m7lxzi/cyXRasrpJW07fs/GhjLM2vOKftVSaBg scKbF2tlx7xHCtnrn3T1zZccNUWW33VrvGbfHJoc7etbqhKNE11UUTr6lEaNYoPalHxh 9aNo8mpAISAGgo88Hn+duNRspJm8DMFXOm5/C8rWG5UMmeNZ+TgzJ/InuIZcXergSXEF Ns2gDMPCIgdH82e/0dIqS0gXNP42c6Uk5oQeFZ8rWDFRBosWOfM+yX5lpbuXvkIeVqJB VdQxN0eb/T7vOF+0/nYCnpKz6fKCKubP1uY8KBIHm4AKJ2QBYAJTM3Mz6ZecEh5YX2HH eNtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=H7U8yGQ+; dkim=pass header.i=@tq-group.com header.s=key1 header.b=mlikXSKu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a170902c60a00b001789a178e33si34961625plr.428.2023.01.05.06.40.50; Thu, 05 Jan 2023 06:40:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=H7U8yGQ+; dkim=pass header.i=@tq-group.com header.s=key1 header.b=mlikXSKu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233024AbjAEOVB (ORCPT + 55 others); Thu, 5 Jan 2023 09:21:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231644AbjAEOU7 (ORCPT ); Thu, 5 Jan 2023 09:20:59 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77698313 for ; Thu, 5 Jan 2023 06:20:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1672928457; x=1704464457; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5NSOtoeMbNg7K9lSDnR+3y2JY7MECEcqj20jo+eSw7k=; b=H7U8yGQ+7lzB/4ayW/GQ9cqHx8UXuEYnafdza/0Epy7eLkx3LJCh0/4W oGP/vkOBVjp2Psb3zxY1DbeGDLUM8y8HN/RI+rusYyw2zUr0y8nbAFK0I WkKu1stXA020Exks7Q5jKkUOvZBUUMxeF6zln+z50adaPargRA6uvpboX AH50/llDHPJwwcwYlEdwmFU8EVq22sPt9rjF4uf0UAIrgu5cC1Eow/P3F kgVKAmARpMaiSIlvHnzJnPq1KJIrAkc14gSHQQOUaxqgyZKgA67P3AA4m 62iP5oLDBs2Ycq6uWlkl2sdIrSLyKYivNgBKzKhXXkQhD/FpyX0iv++Yy Q==; X-IronPort-AV: E=Sophos;i="5.96,303,1665439200"; d="scan'208";a="28261937" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 05 Jan 2023 15:20:55 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 05 Jan 2023 15:20:55 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 05 Jan 2023 15:20:55 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1672928455; x=1704464455; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5NSOtoeMbNg7K9lSDnR+3y2JY7MECEcqj20jo+eSw7k=; b=mlikXSKuHyTwyxv2JRpkP5Gx++ghPNvohSG4XxMs1dcYIJ8O0K/paU9t XbLVqBAforSNlFQLqAGMOe5zZ86Z5OaRaLojihGQ4l2yhXgZAOkX4USoO a8XbMkjWoMsEGyJfFxAFm4bYjBZK2LzZIER4O/AT6eUkkA/7YLkbkmm59 5l/paPAL40FxSReBAa8aCxQHyZdhL5dRAvxqL+68DZxgsREA+IVV8HljM HF0FQolZ0m/7XU4KNVGzagP2EX0fj9t1oUgvTBy5CMGyLnkfmOUivoaLK kTuLLG1A9P70IJUCzgsXM6UQrmLRScO10MjDt6u9VteMsKrKTWoAARNuK g==; X-IronPort-AV: E=Sophos;i="5.96,303,1665439200"; d="scan'208";a="28261936" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 05 Jan 2023 15:20:55 +0100 Received: from steina-w.localnet (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 9C15A280056; Thu, 5 Jan 2023 15:20:55 +0100 (CET) From: Alexander Stein To: Srinivas Kandagatla , Michael Walle Cc: Michael Walle , linux-kernel@vger.kernel.org, Miquel Raynal Subject: Re: [PATCH] nvmem: core: return -ENOENT if nvmem cell is not found Date: Thu, 05 Jan 2023 15:20:53 +0100 Message-ID: <1888904.g5d078U9FE@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <20230105135931.2743351-1-michael@walle.cc> References: <20230105135931.2743351-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Donnerstag, 5. Januar 2023, 14:59:31 CET schrieb Michael Walle: > Prior to commit 3cb05fdbaed6 ("nvmem: core: add an index parameter to > the cell") of_nvmem_cell_get() would return -ENOENT if the cell wasn't > found. Particularly, if of_property_match_string() returned -EINVAL, > that return code was passed as the index to of_parse_phandle(), which > then detected it as invalid and returned NULL. That led to an return > code of -ENOENT. > > With the new code, the negative index will lead to an -EINVAL of > of_parse_phandle_with_optional_args() which pass straight to the > caller and break those who expect an -ENOENT. > > Fix it by always returning -ENOENT. > > Fixes: 3cb05fdbaed6 ("nvmem: core: add an index parameter to the cell") > Reported-by: Alexander Stein > Signed-off-by: Michael Walle > --- > > Alexander, could you give this another try? I've changed it slightly, > so it's a better match with how the handling was before. > > > drivers/nvmem/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > index 1b61c8bf0de4..cc885b602690 100644 > --- a/drivers/nvmem/core.c > +++ b/drivers/nvmem/core.c > @@ -1343,7 +1343,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct > device_node *np, const char *id) "#nvmem-cell-cells", > index, &cell_spec); > if (ret) > - return ERR_PTR(ret); > + return ERR_PTR(-ENOENT); > > if (cell_spec.args_count > 1) > return ERR_PTR(-EINVAL); Tested-by: Alexander Stein