From patchwork Fri Nov 22 10:27:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180052 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp80212ilf; Fri, 22 Nov 2019 03:27:30 -0800 (PST) X-Google-Smtp-Source: APXvYqxSAMkNhT2BbEj75p9uMs0ZzkqtdcocwnMaDhMNCY8wUydPD0Adv5uotEo0+Ghi1brISASs X-Received: by 2002:a17:906:1354:: with SMTP id x20mr22087395ejb.131.1574422050790; Fri, 22 Nov 2019 03:27:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574422050; cv=none; d=google.com; s=arc-20160816; b=agzajy+gNAwoDtqulFA8sFMMg/ICXsDYIWJ5k6NQf9KEfMS4zuRjRlXc3ioYzWhaFV AVYhD+oD/27EzaANSlBxj2fOhenM4C0VCEtZpIBJ85O3/UqxJ/B6HlWhbbaPXSin0wSS oJx3nMeGVUj130M3EGdtyYASSUlYGB3jaaaSuV+koyLg4KIb+3qR/VbWs1E3XUynsNQR +UrYHJm0FbjDkyYYD9PmyPzXpkgD3Wl5RKNTFvPjF9qiFHEzB5KDf/IBJ/7AL84tp6YV k/cNksjoSoi/4PIFqWjAlawFFkhZyZR4ksl+o7gR0yUQAlc6yEAfXgX4hinFYOYECLSb SzFQ== 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=bpaexqij0zu2wyTy840S7+pXGDrekb6olUrfceFJM9w=; b=0fCFM1clXumsqpkOACK7vxqwFeRwTVB48hdJccfsa/sfZVjvujCZQCvdyl0ZHHuXpq Udqg7R0hwOvqqmuX2oMRqoH+F+V/AntAhs8KNxfGR19019vHix0xM8yW5zfMxCT7BMVm 7hdwhJbhMN5mLDOSkrpqAuyRL4U2XGdoOjBiD5RX6Z0WpRcQDYEekV/qGr6hJNSOETaU sComW30RDkQ6zui9+ReUnUlUgWcglgRKAQJ1zGr6OBGAEEAH70q2wN85zCYB/M1faF+I mAM5cqyOaDUWW67bMrpre+VeIw2RrddRcJxQgPJNC0LYbNAa505YW7c/QKzJanw6s2B0 0tbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MvZ76YWH; 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 c6si4152997ejc.350.2019.11.22.03.27.29; Fri, 22 Nov 2019 03:27:30 -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=MvZ76YWH; 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 S1727779AbfKVKco (ORCPT + 26 others); Fri, 22 Nov 2019 05:32:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:54474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727747AbfKVKcm (ORCPT ); Fri, 22 Nov 2019 05:32:42 -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 E4B9820714; Fri, 22 Nov 2019 10:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574418762; bh=NRLAl6V12SzZIvNvM/58GkrMfGcZ5KGi5UFCtt3HtR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MvZ76YWHk9fFNmmJLfNok5UEohb/qzt0RV+PKSFgy19SFKMzyjs652BWN366JJlwv 5rx4DHrE2i9NiRTIpPXYNBOyoFQQXZUGEOTEKPpmlpBCJqoVLlOa3eCycrRXSYm9xC UBkCgco0pHh8eOq1/eJTK+j8b6jWqXJZ2gFTaidw= 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.4 044/159] nvmem: core: return error code instead of NULL from nvmem_device_get Date: Fri, 22 Nov 2019 11:27:15 +0100 Message-Id: <20191122100737.184105147@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100704.194776704@linuxfoundation.org> References: <20191122100704.194776704@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 931cc33e46f02..5d6d1bb4f1106 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -457,7 +457,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); }