From patchwork Tue Aug 7 12:19:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 143579 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4441643ljj; Tue, 7 Aug 2018 05:22:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdtvRWbd0gNCWecrC2dZpGSwmOyWT6w9GaHPLaoOduYRdRftBagRAl3kJvO9UOY22JXsdHo X-Received: by 2002:a63:460d:: with SMTP id t13-v6mr18476945pga.201.1533644579694; Tue, 07 Aug 2018 05:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533644579; cv=none; d=google.com; s=arc-20160816; b=EMTu4NFs1ShYPw1iqelWHPGS3SIwUcoxyXaA8X0GGzF/d8I5DpfqxravxkR6LAMl7K uk/xEOMQDFrJDUYvIQVRsik5YPC3NNraAzCckZql2bLnQ6kAH20krtdmVnS25ru1Haj/ dbcoaDHwrwKNeRRcZk4PlL1TSWN6n33FTc69yKDbYqFJZ73cXrZdijuwOqyN1/wx8VA1 DYmgbisYTXxo0Kd9PYgwkTqaaY+0L+YD62Q1XltDV0OBwKe1Oi5jnKQG2hVUmTX/9zTU vWW0h6WsEHIVjiBH1PNeCW3Lc6MDV7g78yiSQeeRYGs92SyNykDwumpoxFPeGDf5ERFz aq7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ax9UHW3ewkE4/uBesYwUO7e7O7TyW+sjcfNTMdNL530=; b=y2NpGdJ/4s2KHTWB8J884TYtM9SypQy2IEfO1s2U5+lTfeyKdRazWX+Y3bjzmx6klG +bSe2Zt9AGKsQWYCOJSQSEJOeuFcKYv2SoSf/VG3dwWfuX4Ot6HFSUlodpTSk6/Jo5Xy zFIe/1jCCeLuKXCRhGQOsn8Dl5jcDw0fgyMMubhcahSCNiK/fanwKLV6xUNkMbCyGvRl WlC8oQcrGmG9aUVv8CLRVGpCQyYoQlKui2pvdkhBFAFjgbKcFdYEmu/dYC1avAynOXtc JhHz5OQA3jz7RyLnzvwKyxmhTM1khqU/uwNx6wY8fNhbtvlkVG1kKDbYYL8m1nppyZ+d 4z4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W0v0T8KO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5-v6si1290574pgg.84.2018.08.07.05.22.59; Tue, 07 Aug 2018 05:22:59 -0700 (PDT) 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=@linaro.org header.s=google header.b=W0v0T8KO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389029AbeHGOfs (ORCPT + 31 others); Tue, 7 Aug 2018 10:35:48 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42031 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387931AbeHGOfs (ORCPT ); Tue, 7 Aug 2018 10:35:48 -0400 Received: by mail-wr1-f67.google.com with SMTP id e7-v6so15562531wrs.9 for ; Tue, 07 Aug 2018 05:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ax9UHW3ewkE4/uBesYwUO7e7O7TyW+sjcfNTMdNL530=; b=W0v0T8KOHI7gB1OWRZTepzBIYC7YFbyVjgsktKUDshZvu9AH3wmpYZ+XRfI44PlkLy XtDa7LHS4R668W5lCBQvaBS5EUlUEKIDor+sZWSWFgtWELKvTVlCmyWQC1hYK8hlMrJ2 7pSGh5CNL4l49XD4uY+P0c+m+JF2zwI2x9jcw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ax9UHW3ewkE4/uBesYwUO7e7O7TyW+sjcfNTMdNL530=; b=QNC3KTLurt/xyhx8jmgo/H3Q9E7a7WyNbt/1ucLN8/+VA0MJBn+BieBnebWUmG32it pnFFKrMmU9qfQp9RdQP5Jsm0W5YkEdcBrE7wICzecEhC50DJyPh6hNMZU+N/BiaS1IRx 27uXWMmwoZjmbQNXEiubrYyGIyD+8cdQcA1aiuKyPdfd7/cqeuLVKO2uDzfTnGP93qez pE1QnQF90SZApdZuHCMi1AUUyXKvyOc/bheUx6xKiYRfq//R5dW419yZaIs/2PxAhOtc U6kFX8801jCS2CkLoVU1MHJt1okk9sELw8Ct0yoGF7dwf4iXlSDaxFy1vKG+pub1r1hD gnTw== X-Gm-Message-State: AOUpUlFMBuAJyiymomxN8XZNRZI2vEXzBwFw7RNKztBUbWi3mFzDmebR s8ARIMBvPN3zAj5ceDs9t6t+rQ== X-Received: by 2002:adf:9086:: with SMTP id i6-v6mr12146167wri.271.1533644502796; Tue, 07 Aug 2018 05:21:42 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id e10-v6sm1106535wmh.19.2018.08.07.05.21.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Aug 2018 05:21:42 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, niklas.cassel@linaro.org Subject: [PATCH] nvmem: core: return error code instead of NULL from nvmem_device_get Date: Tue, 7 Aug 2018 13:19:35 +0100 Message-Id: <20180807121935.29653-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/nvmem/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.16.2 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index aa1657831b70..6f064002f439 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -679,7 +679,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); }