[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87ikpn57sy.fsf@bootlin.com>
Date: Thu, 06 Feb 2025 17:58:37 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Edward Adam Davis <eadavis@...com>
Cc: syzbot+074732af3fc6c528f8a0@...kaller.appspotmail.com,
linux-kernel@...r.kernel.org, linux-mtd@...ts.infradead.org,
richard@....at, syzkaller-bugs@...glegroups.com, vigneshr@...com
Subject: Re: [PATCH] mtd: capture device name setting failure when adding mtd
Hello Edward,
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 724f917f91ba..a71cd75858e4 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -741,7 +741,8 @@ int add_mtd_device(struct mtd_info *mtd)
> mtd->dev.type = &mtd_devtype;
> mtd->dev.class = &mtd_class;
> mtd->dev.devt = MTD_DEVT(i);
> - dev_set_name(&mtd->dev, "mtd%d", i);
> + if (error = dev_set_name(&mtd->dev, "mtd%d", i))
Thanks a lot for the analyse and for fixing this. May I ask however to
follow a more common pattern for error checking that is:
error = dev_set_name(...);
if (error)
goto...
This way it is closer to the usual error handling and also aligned with
the rest of the file.
Otherwise LGTM.
Thanks,
Miquèl
Powered by blists - more mailing lists