Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3113799pxb; Sun, 20 Feb 2022 09:40:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlyzzvHX9nRREZMDtHUpEWPP8OogOkh49nrJl1dTUTtsk8LEAhidIPiGbQ4dixjap4ECGf X-Received: by 2002:a05:6402:34c5:b0:411:f082:d69 with SMTP id w5-20020a05640234c500b00411f0820d69mr17830059edc.65.1645378817682; Sun, 20 Feb 2022 09:40:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645378817; cv=none; d=google.com; s=arc-20160816; b=NxV2KDYUS1UUHxrO68vk63kI0+AWFiJqXWiANeNjX0YKI7x3135to4aty7pVmyqMyR q6RQNpQCbV1hMLBjHzHaza1dbi8MFjDyLdJ+JbSxmfGoLTkO4NATy7EYuynnj3IDb17G XkMa3owbCUnnyaWbn6UMZAG5l/H+DELqAkGlqobdYn26PIZP3o+f3Ip4q0nhdvCz9fgF IM91aehVb15Eua4L+81kJFZD3WRqhKHtvWvLRDWegw7419hJOHOOsaEpZDKKIf4V3XeY 7d5il91lpsEgqai80AF7qVIU5N0KaYyJmGhTZDWSrsE/VXwwDbyLS/eRup3xa4Epj0BQ TtOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AjbCoFPHwgXlgVhaHAoW47X9tb9L1pRYHiXqltbW+iI=; b=bNLBb4wK/V+RamsjbTJvHT31tWdx9RgYVhBl20D4fX99UEszVLHNa9g+smmw9lwgR7 nDXssFgPqxHf973NbbXDgAGbsflSlmM4/bcB4QN6BNKOQpCkhrUnMGYkmJFnqBhIW6ha DNDO9v2eDi8bj+FaLO1phs5u7tJBgST9QaR7dseSiUCM+Tgv7eS0J4D1KAE8y8zJOEMt OdoU8WrBa/qFE/CeG5g2skta5RFxXQcZ4zGYMrmhRZH87QeQHgFCB8UdCGc5el6xvCdc zwyX1u1XvIS0YWkGywTHLSjc3bHApAZXgq/Vri8OXeR2kcAC+c7LcP8McfXWlhS+eI9i JsAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F7r6smAu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3si7181929ejo.614.2022.02.20.09.39.54; Sun, 20 Feb 2022 09:40:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F7r6smAu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S244159AbiBTPQU (ORCPT + 99 others); Sun, 20 Feb 2022 10:16:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244126AbiBTPQO (ORCPT ); Sun, 20 Feb 2022 10:16:14 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14EE634BB1 for ; Sun, 20 Feb 2022 07:15:53 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id c192so8135839wma.4 for ; Sun, 20 Feb 2022 07:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AjbCoFPHwgXlgVhaHAoW47X9tb9L1pRYHiXqltbW+iI=; b=F7r6smAuasKrsIW1o21RG/D+0ZGoEoQM/S5iu5VNpy7tAQX5NpGfvAK06AeIDggyIc UPfKFtqX+dJch1F+xhLRrb/8pb/HLnjAPOwXve0HvxVYVJzFaEkqIKsb397NCVoxjwFP X+KjLN/xe5vc9A9I6EE4zBX+Ix666ReazrzSxgJDqAS7FSuh+6IFq7DA1BDzcBbFxdam ZzRtUz+UVTavm2KR6y/4jFIV0px2UjsFDVqStdE9D1zyVv0RcVvZUSYHwwo/3R5gkHJN 1Tz9zxfAtNAPYCbnREaWm9v5nst48Jkgq7oobG+KhagFTd9JKoHyJAPtv5OT+leL5mAP 69pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AjbCoFPHwgXlgVhaHAoW47X9tb9L1pRYHiXqltbW+iI=; b=zc68OR1FhVOaw9SZc4ehg4TgQiF1qTd+wChQZvZSKDuMHbNkced78ZOIEYsNnzR/61 e+h4xJNMylyfrNCvnQh5oTExR5rt5sB1DjwcqRjk4qdN9XOaYBpjDLVXgAZq3Jm57YLn 7pX+pBe63nGpB6YZ/Z0Ld00AXFyXDsp7XOwPdjyxrkEACQFVR6TdDuvyO3Kkzx3/R1j9 iLLeV6Ou8AVOecGQflgQ/C3bZI5nyfY5/PX5lWuJ1bT3zpd8IzAFNiXTK1rgrs1VraZV MQj1AopEgbbCBzAXgwbvI2X9s5+qOolrh7cJtIlf6/lxYzk1+Qtz00G06m/Qtzb9wRyF 2iIg== X-Gm-Message-State: AOAM5334SDmZB7udNeRb+e38SEwj5B1qaubD6Tljh/TrXDYuOcNCORFh JbIB8J0aZZgK1iWhWfnbeNRpe8I6HP593A== X-Received: by 2002:a05:600c:3512:b0:352:d502:bd0c with SMTP id h18-20020a05600c351200b00352d502bd0cmr17751784wmq.164.1645370151696; Sun, 20 Feb 2022 07:15:51 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id h7sm28687749wru.41.2022.02.20.07.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Feb 2022 07:15:51 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Andy Shevchenko , Srinivas Kandagatla Subject: [PATCH 03/13] nvmem: core: Check input parameter for NULL in nvmem_unregister() Date: Sun, 20 Feb 2022 15:15:17 +0000 Message-Id: <20220220151527.17216-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220220151527.17216-1-srinivas.kandagatla@linaro.org> References: <20220220151527.17216-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko nvmem_unregister() frees resources and standard pattern is to allow caller to not care if it's NULL or not. This will reduce burden on the callers to perform this check. Signed-off-by: Andy Shevchenko Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 327c88c432f0..f58d9bc7aa08 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -903,7 +903,8 @@ static void nvmem_device_release(struct kref *kref) */ void nvmem_unregister(struct nvmem_device *nvmem) { - kref_put(&nvmem->refcnt, nvmem_device_release); + if (nvmem) + kref_put(&nvmem->refcnt, nvmem_device_release); } EXPORT_SYMBOL_GPL(nvmem_unregister); -- 2.21.0