From patchwork Fri Nov 22 10:26:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 179969 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp23928ilf; Fri, 22 Nov 2019 02:41:40 -0800 (PST) X-Google-Smtp-Source: APXvYqyLWnnYGkULuPb0g8NRLZoHOj9nHg5swUMAdGEMrRweuQ7bIZ5uwIxssoKViC0HOIdQ2wW7 X-Received: by 2002:a17:906:2518:: with SMTP id i24mr21509470ejb.4.1574419300115; Fri, 22 Nov 2019 02:41:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574419300; cv=none; d=google.com; s=arc-20160816; b=j0yqzzgT/3Z7pkLMBtGThpU8IU7jk9CLozPZIR3Xdfp93ppJ58aC++qZVXilGdp7kM sf7neLqDLMqoI7zAYRpiizkQX17eUZ1fj1cPL450w+42+tQZpTRyJAr5GeSbU2gmnPjz 9rvg0gDnpRMMDPeNM5Dncnp/juw+KpXMXSNYjsYZ7PpujVTCarozThr92YzJ/7oS9vAt ukHEKVBmSe7kyZN8sUrqAjoOAyQpEt826CAv357ZOM06e1WzRwEbaL7PjevPo7tMow93 9R9RlUXviFaCXW57wVBN4uX5N9p7LOp1FcOj3bBtNS726DuNbLs/SbiDP0X3+C8YR3LB IwDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OeF6caLd9B7S+B4jwTP0+37+cXCr34QbH3dO53zOpMs=; b=VWvQ1E3cmr9WNDYscCqELegUbeoPV5X7cwV0QJ78RKcSKVmld21q0Kox/4jahBdMek ybd3NimHum2Wq6UTm2SlTGVAavZfQEjV+dGFx7UG9r3EJiTeBjVjh9yOpWBWhamrGE8y xTBIo2/+50zwd6sIU/B9XR5B+VdDpRkKYUYkx1aLNT3KR2yfhBL0OCsVHDx57ZCFLVrW s+7szQ9YePjfB1YIzHyq2oZBFYvzSMELcib+J06tkKrz/XgUTl0g0n5avWLgCOZ3Mqlj BFD8ixvgzWPHF7nzvurc97aR9/8vR2G581/clFZQQfttdczup+6rq5fC4G4yI/EqLrft 9Q5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x9mT53Ri; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p20si4679116edi.252.2019.11.22.02.41.39; Fri, 22 Nov 2019 02:41:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x9mT53Ri; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727028AbfKVKlg (ORCPT + 26 others); Fri, 22 Nov 2019 05:41:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:46178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728513AbfKVKlf (ORCPT ); Fri, 22 Nov 2019 05:41:35 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0C09220637; Fri, 22 Nov 2019 10:41:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574419294; bh=v1prjkhELBhwKJpCCsadHkv68GhTa67gCjrparn07S0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x9mT53RiOiKR4tQRBGHu6brsOHF2UrgUEcSo5/qBljnsGt38kzJt5SmsETgRlyHe3 hoM+d4HZM/TPVr8/BZmltGAHxA6kzDOxmsTD8/QTGPQkvZ5WepSNbmWRj1Ek8HxFmq E3K8veGjysQxDrN9buQ/1a3wyZ/PnIGheMoSl0bc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Srinivas Kandagatla , Sasha Levin Subject: [PATCH 4.9 061/222] nvmem: core: return error code instead of NULL from nvmem_device_get Date: Fri, 22 Nov 2019 11:26:41 +0100 Message-Id: <20191122100859.001421740@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100830.874290814@linuxfoundation.org> References: <20191122100830.874290814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Kandagatla [ Upstream commit ca6ac25cecf0e740d7cc8e03e0ebbf8acbeca3df ] nvmem_device_get() should return ERR_PTR() on error or valid pointer on success, but one of the code path seems to return NULL, so fix it. Reported-by: Niklas Cassel Signed-off-by: Srinivas Kandagatla Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/nvmem/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 9ca24e4d5d49c..2a0c5f3b0e509 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -609,7 +609,7 @@ static struct nvmem_device *nvmem_find(const char *name) d = bus_find_device(&nvmem_bus_type, NULL, (void *)name, nvmem_match); if (!d) - return NULL; + return ERR_PTR(-ENOENT); return to_nvmem_device(d); }