linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Andreas Noever <andreas.noever@gmail.com>,
	Michael Jamet <michael.jamet@intel.com>,
	Yehezkel Bernat <YehezkelShB@gmail.com>,
	Alexander Usyskin <alexander.usyskin@intel.com>
Subject: Re: [PATCH v1 4/5] mtd: core: Drop duplicate NULL checks around nvmem_unregister()
Date: Mon, 10 Jan 2022 09:11:57 +0100	[thread overview]
Message-ID: <20220110091157.6396569e@xps13> (raw)
In-Reply-To: <20220104133843.44272-4-andriy.shevchenko@linux.intel.com>

Hi Andy,

andriy.shevchenko@linux.intel.com wrote on Tue,  4 Jan 2022 15:38:42
+0200:

> Since nvmem_unregister() checks for NULL, no need to repeat in
> the caller. Drop duplicate NULL checks.

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  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 70f492dce158..010ffc34532a 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -742,8 +742,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);
>  
> @@ -921,8 +920,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;
>  }
>  
> @@ -1026,11 +1024,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)


Thanks,
Miquèl

  reply	other threads:[~2022-01-10  8:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 13:38 [PATCH v1 1/5] nvmem: core: Remove unused devm_nvmem_unregister() Andy Shevchenko
2022-01-04 13:38 ` [PATCH v1 2/5] nvmem: core: Use devm_add_action_or_reset() Andy Shevchenko
2022-01-04 13:38 ` [PATCH v1 3/5] nvmem: core: Check input parameter for NULL in nvmem_unregister() Andy Shevchenko
2022-01-04 13:38 ` [PATCH v1 4/5] mtd: core: Drop duplicate NULL checks around nvmem_unregister() Andy Shevchenko
2022-01-10  8:11   ` Miquel Raynal [this message]
2022-01-04 13:38 ` [PATCH v1 5/5] thunderbolt: " Andy Shevchenko
2022-01-04 15:27   ` Mika Westerberg
2022-01-06  1:11 ` [PATCH v1 1/5] nvmem: core: Remove unused devm_nvmem_unregister() kernel test robot
2022-01-07 11:57   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220110091157.6396569e@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=YehezkelShB@gmail.com \
    --cc=alexander.usyskin@intel.com \
    --cc=andreas.noever@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=michael.jamet@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=richard@nod.at \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).