Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3162313pxb; Sun, 20 Feb 2022 11:06:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJypwzK2U4zDWqYtM2IdXroCv6gFCK3uSOazcd4Z0AYx1npVy+8a2tmZqElhr1NtwXMVikCl X-Received: by 2002:a05:6402:27d4:b0:412:b81a:b2dc with SMTP id c20-20020a05640227d400b00412b81ab2dcmr14154124ede.87.1645383990874; Sun, 20 Feb 2022 11:06:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645383990; cv=none; d=google.com; s=arc-20160816; b=kgplmf0/2S57pXpwCGy8GEXPe0ShOnEwpNzztFbR3BcARW0jVG6kQXsQp56SmqpevH yLlnvwdVo0cCeg+gsPb66cJw8zeHCx6da/ifnxmhkxnQSlW3okIhh/j8lO33oqDUNi9v BPprQLeYIvRw0l7WyaqTMawCx7M6PCA8PW4y+ewsvGhUzgnsHcRkgxLqxkJrjn2V6bLR OmgjHTbnrBafztJV7ln6n4XfufLcayOI4yGwBmJi6CXXlITM6Mj3CTaLkD4dRqgPjuWL VqVpVNxlwT7L7F1ZHS+TrjxuxjnXUlL08S4wMDrAtcicT5Eno5j6z0j+BCsI/kuNxDyX INGw== 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=s4avYTwyzOebeNnD3c9KYG3x29F/g/qJAaU+xvILJYI=; b=JlOvSbqcWa+IQo/IOPF1owfkk+x39FmojOSO6cbkO2D1ntzzS7vs9JJlAupCyMPigE 3Dfu0Wj7XfcS0mMM/Fy0AVsKORtV/OQX8U/tWSxLWDi09F73WNTMx6b8CRTfN+MT593U QXy999Hogjw/ZGx1Aaxw0kAadqk82CfKok5IWm2WufG/K9Hu1OtjKuxvUS/K8kcq42ew B+iC1HVe3lHsQ6JlAVWtNodLisHZzaQQzuO0r6G7nQ4bCe/CEOpCLfVVyHgWMahLqpe4 rdEYwhSfg9P7m4/tPB+ZcLU/DofFt0Fl4m/KPvsPCcFc9KSTLkpLHv43HAJ7oatjAhon yrCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CyvN1XID; 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 dd15si3020516ejc.275.2022.02.20.11.06.07; Sun, 20 Feb 2022 11:06:30 -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=CyvN1XID; 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 S244239AbiBTPQu (ORCPT + 99 others); Sun, 20 Feb 2022 10:16:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244126AbiBTPQX (ORCPT ); Sun, 20 Feb 2022 10:16:23 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 196F734BA7 for ; Sun, 20 Feb 2022 07:16:02 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id u1so22822359wrg.11 for ; Sun, 20 Feb 2022 07:16:02 -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=s4avYTwyzOebeNnD3c9KYG3x29F/g/qJAaU+xvILJYI=; b=CyvN1XIDtWg75xXtJrI6e/JFb+l8W5fc/x1tgXu/uo/QvyxASasB0e/Ucgk5cL22uq J4iO65m4myKX0yElNJ1CjsjgFDOflMyuL3xmRq0LsqriZkfb/da21PMaxtEZP598xGUD vjehGlzrausTrJIc7Ki6n/FkCN3GmOwxakwYrIilX+u+Ok4Nl+8DOTi+kzhpQrRHXzZ9 LNARSTjyeUMzFrd0JoInhyg1HaDShd4jxp4htwdBo3aOkNGXn/lwwqL2nlh/rOI9owMe KQKIdqrp7q4qruOdpG6p9JT2ZZ08LLNrSHIZbofnparUcKl+Q14tWD/XQ/kRcEasl2GF v5mQ== 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=s4avYTwyzOebeNnD3c9KYG3x29F/g/qJAaU+xvILJYI=; b=sRyTzag6N9a3x4utfyUY11UtaYr3solq9fI2c4ZXGtnef6RRRv0ihl9ZTJhkKt5HnW kjNyyDC03f80okqpNMxT3jPIGUQNAz7PGwyc69+KxNy06q/Gjw7hOctXjN87tAlZtmlB MbxZZscx8ncGSGt/K0IG7+SWFrtuBHoV8nATfxjT6pfV3ppVXcTPmK1gqy+HzMR+KsrH aHsRnMSD0HggphUCdFB3S+av9fe0XEwOd9+iMieCknyYnXDt5HU913bS1yw3BN+sDnXD c1iyt8objnBeSr8cXBZqsoGZN6xRuLkHmRrtX+DPhEMJmcC9ok3Y4FTiHqcSlZaUFSb0 MOWw== X-Gm-Message-State: AOAM530bbXEz3n3+Lj1ZoD3tw5+PkkkFL/uUB3VX3ZeUeD94R/We8oEj Rdo2SQThG9QkXeEDl13snTkCYQ== X-Received: by 2002:adf:fb4e:0:b0:1e3:3e66:d5f6 with SMTP id c14-20020adffb4e000000b001e33e66d5f6mr13203959wrs.615.1645370160720; Sun, 20 Feb 2022 07:16:00 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Feb 2022 07:16:00 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Andy Shevchenko , Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 12/13] mtd: core: Drop duplicate NULL checks around nvmem_unregister() Date: Sun, 20 Feb 2022 15:15:26 +0000 Message-Id: <20220220151527.17216-13-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 Since nvmem_unregister() checks for NULL, no need to repeat in the caller. Drop duplicate NULL checks. Signed-off-by: Andy Shevchenko Acked-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/mtd/mtdcore.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index eef87b28d6c8..fc6090366684 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -743,8 +743,7 @@ int del_mtd_device(struct mtd_info *mtd) debugfs_remove_recursive(mtd->dbg.dfs_dir); /* Try to remove the NVMEM provider */ - if (mtd->nvmem) - nvmem_unregister(mtd->nvmem); + nvmem_unregister(mtd->nvmem); device_unregister(&mtd->dev); @@ -923,8 +922,7 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd) return 0; err: - if (mtd->otp_user_nvmem) - nvmem_unregister(mtd->otp_user_nvmem); + nvmem_unregister(mtd->otp_user_nvmem); return err; } @@ -1028,11 +1026,8 @@ int mtd_device_unregister(struct mtd_info *master) memset(&master->reboot_notifier, 0, sizeof(master->reboot_notifier)); } - if (master->otp_user_nvmem) - nvmem_unregister(master->otp_user_nvmem); - - if (master->otp_factory_nvmem) - nvmem_unregister(master->otp_factory_nvmem); + nvmem_unregister(master->otp_user_nvmem); + nvmem_unregister(master->otp_factory_nvmem); err = del_mtd_partitions(master); if (err) -- 2.21.0