[PATCH 5/5] mtd: Don't print a scary message when trying to remove a busy MTD

Boris Brezillon boris.brezillon at free-electrons.com
Thu Jul 7 07:58:05 PDT 2016


On Tue,  5 Jul 2016 00:06:23 +0200
Richard Weinberger <richard at nod.at> wrote:

> Just return -EBUSY and everything is fine.
> 
> Signed-off-by: Richard Weinberger <richard at nod.at>
> ---
>  drivers/mtd/mtdcore.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index f49e103..f2dea88 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -499,11 +499,9 @@ int del_mtd_device(struct mtd_info *mtd)
>  		goto out_error;
>  	}
>  
> -	if (mtd->usecount) {
> -		printk(KERN_NOTICE "Removing MTD device #%d (%s) with use count %d\n",
> -		       mtd->index, mtd->name, mtd->usecount);
> +	if (mtd->usecount)
>  		ret = -EBUSY;
> -	} else {
> +	else {

Nit: can you keep the brackets around the if (mtd->usecount) block (we
usually only drop them when both the 'if' and 'else' blocks contain
a single instruction)?

>  		/* No need to get a refcount on the module containing
>  			the notifier, since we hold the mtd_table_mutex */
>  		list_for_each_entry(not, &mtd_notifiers, list)




More information about the linux-mtd mailing list