From patchwork Tue Nov 19 05:18:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 179692 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp167732ilf; Mon, 18 Nov 2019 21:48:33 -0800 (PST) X-Google-Smtp-Source: APXvYqwFEAxS2daCpmdJ92GPW9c1M2ci8exF5pe02rmpvFmesG7x8wzMFqliIiG6Wdcex1UdnJXi X-Received: by 2002:a17:906:4098:: with SMTP id u24mr31961164ejj.220.1574142513353; Mon, 18 Nov 2019 21:48:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574142513; cv=none; d=google.com; s=arc-20160816; b=TWewXd2eiOC7j8bgwGDRNh3BB0iJkwx2glAC4EKY1XRZXzP6plGKDIbX6crEduk8j+ HSyhSZisPLHlJHPnpbFk02T6WlStTXpFxzSOQvXKB4NxhXvU0lHyLSaOTS3xxRhQahVW bCKpzUVbMKLEw8rzXnL3AL+esPm0OK2jxK0nWn4X9Q0znh/XlqjS2WVlpTRwZDVrbZ7p o1+a7qzjSrdwWOGXimMNEwFXaDtIbqw4H4bEXycypkqwiM+mVhcJ1uVUwnoytLWLCgLc H8naf04I+3lfR+I5UdHKPswWL+6ycILDzsgejeXfu5gOrNKDC4UFb70ifQReQxW2e5Yb GVFA== 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=d6LHsHbkRq3rSY4/Nz+4SEavyEjBY5fbttjyIPhuBgo=; b=DUoSRPLMWsn2f2fBWXPp9NRBAPGSmAMSmmOEsseAJEaZa3iVvfCGMEp6kloqZfsUfc MrBXW0nnMpevQCeXuzx2DUAXFsYkzB3j52a+wzbtNH/EGl3W+cYQntda0KOnWendBu8E Bl1fYrf9LnpgDJGE6x54cfaoWf0Gylrm/MoWbmI4DwE7fK3w6x4+KQ2ybFDuombJc7zx dK3L21kj4ojh89ocpKFngHXD0m94BPNYLe9gJIpVQtvs98fOVQkgFf3FyS+OZQc9scO4 JEiRcYd91q03Qpm9e37g12n8UyV8dS68s6TIL6rQwfaEzOWD4XqLIKAikwi6Dt5RiTMT 8f7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zB2dSly+; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 y9si13259897ejp.175.2019.11.18.21.48.33; Mon, 18 Nov 2019 21:48:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=zB2dSly+; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731367AbfKSFsa (ORCPT + 15 others); Tue, 19 Nov 2019 00:48:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:45094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731366AbfKSFs3 (ORCPT ); Tue, 19 Nov 2019 00:48:29 -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 205F22071B; Tue, 19 Nov 2019 05:48:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142508; bh=+tsNtYF+z2Lyp9tPCd2Dr0PqAGfSfurgQujhAXNneP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zB2dSly+InjnRQmeygzpkYQS7ad8lse2+wZj4ihGblipnhO4383OMxPGEFQuWsGfN JB8wCY5nGwFIqSSwMhgapgNmejWra9kqst9Lk34U/5QznhNAoRz0OI1soVkxH+XVDO TYswGQyrDFk4r6kwigCLK4AQYYMCoRG2rtRb1prI= 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.14 105/239] nvmem: core: return error code instead of NULL from nvmem_device_get Date: Tue, 19 Nov 2019 06:18:25 +0100 Message-Id: <20191119051325.923866588@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051255.850204959@linuxfoundation.org> References: <20191119051255.850204959@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 b414d9d207d45..08b171731664e 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -617,7 +617,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); }