From patchwork Tue Nov 19 05:16: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: 179649 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp155423ilf; Mon, 18 Nov 2019 21:34:01 -0800 (PST) X-Google-Smtp-Source: APXvYqy9avpujfoESG12mcSNX77zkKhsvG8TH4VbVyBtIBPGj4QdXhJ3FjpbWeZajiMWUOx7B7B+ X-Received: by 2002:a17:906:ecad:: with SMTP id qh13mr33135070ejb.25.1574141641203; Mon, 18 Nov 2019 21:34:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574141641; cv=none; d=google.com; s=arc-20160816; b=ZHoZ5d43diUW4BlX88Yq8yAosXXMuw31ajQVqWxjjWx3YPeTxkq8foDOK7N7K8zcgf T6XJuWfLz0M2JzFHVXhxi0v0+iADOn5IQP0M8P6quY1h3c0XWyBpCqTqL1vlMp3f0Ih6 zsr++bpD1E8v94WcHoNk5ZIiovgOFU+9kRrPapBJdqgsnCv7CUGdTSYW6Uy+3tr+RvdS 4IZFXw/1+whRm50/P3NIvrhpEeWBnTJiUIdO/+Jj3lKYi/TbTFsGQAhb5301BGrnenKJ 8Uizsz70VIOFYLfWYzLcIRNRnu4pD0D3wYa8xUbXLl6voU+5m/zsPOHseug0DjQCOsoX 9m7A== 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=02i+2T3S/95z6bn3lJ4yjJu/JSQTvjFMEBo54kCcNSU=; b=ciJwO3lh8cgeSQOz6uLhFACybvnvqRdXDEHuj74BZavrZENpAaa4H5hhrJ1LEWuGeT 2T9Z0qo/dukSubxzbZP+MWDFge4BpAGhiOtYGyEtXO1upsYb+p74nGVWBwSXCTUEa4hX fDsVM1ycVaykRde9P6V+5DPm5PfFKjqkrZz0wkQ77phXdwDSlz+udK0iZMNhm4RlBUvD 6v3oh/lnQhW/b78UctiJKidckugmM6aJoOeXZU0u9Gzi3DVS0X8lrpH1nq8TW9741/rs rjPNSl9OQsc0/96AJMi6vXwHox/nLuut+m5p6GRltpDnqvGD45xP7EOIGXkqtaJydjzb 0GSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X7kesEVq; 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 e10si13192788ejq.413.2019.11.18.21.34.01; Mon, 18 Nov 2019 21:34:01 -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=X7kesEVq; 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 S1729599AbfKSFeA (ORCPT + 26 others); Tue, 19 Nov 2019 00:34:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:54582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728843AbfKSFd4 (ORCPT ); Tue, 19 Nov 2019 00:33:56 -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 A00D1206EC; Tue, 19 Nov 2019 05:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574141636; bh=tU1uL0kgHbeIfHi2VXruJE3ZdOm5oSbiBE7SyjAQ0hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X7kesEVqZYerwY76senzfHpws9cTcWPJuhLCCKafRKluQGPAGUmDgW5KKVsmcwLRZ 5Rbtr4R5LdqNTmjR5ePW/+M8V0Dri/JKB7a839JI+ITN66qKIQ/jPVjjltD155l3KH KlDFoLjFS7ftHjpLQbzHzG3Fj5TSMmnYewYjTH8Q= 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.19 188/422] nvmem: core: return error code instead of NULL from nvmem_device_get Date: Tue, 19 Nov 2019 06:16:25 +0100 Message-Id: <20191119051410.688562851@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051400.261610025@linuxfoundation.org> References: <20191119051400.261610025@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 d32eba11c000f..30c040786fde2 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -692,7 +692,7 @@ static struct nvmem_device *nvmem_find(const char *name) d = bus_find_device_by_name(&nvmem_bus_type, NULL, name); if (!d) - return NULL; + return ERR_PTR(-ENOENT); return to_nvmem_device(d); }