Re: [PATCH v2] mtd: leave the device type unset when naming fails

From: Miquel Raynal

Date: Fri Dec 04 2026 - 16:37:11 EST


On 08/11/2026 at 15:48:48 -07, James Hilliard <james.hilliard1@xxxxxxxxx> wrote:

> add_mtd_device() uses dev.type to reject a second registration of the
> same MTD. It sets that field before dev_set_name(), but the failure path
> for the name allocation leaves it set even though no device was
> registered. Retrying registration then warns and fails with -EEXIST.
>
> Set the type only after naming succeeds. The later registration error
> paths already clear it before releasing the device.
>
> Fixes: 6697dae1e2da ("mtd: capture device name setting failure when adding mtd")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: James Hilliard <james.hilliard1@xxxxxxxxx>

No longer applies, please rebase.