[PATCH MTD-UTILS v2 4/4] ubiattach: fail if kernel ignores max_beb_per1024

Artem Bityutskiy dedekind1 at gmail.com
Thu Aug 23 05:55:32 EDT 2012


On Wed, 2012-08-22 at 18:04 +0200, Richard Genoud wrote:
> If the kernel doesn't know the max_beb_per1024 parameter in the attach
> ioctl, but the call still succeeded ubi_attach and ubi_attach_mtd will
> return 1 instead of 0.
> 
> In this case, the ubiattach command will detach the device and fail with
> an error message.
> 
> Signed-off-by: Richard Genoud <richard.genoud at gmail.com>

Pushed with some amendments, thanks!
> +	} else if (err == 1) {
> +		/*
> +		 * The kernel did not support the max_beb_per1024 parameter.
> +		 */
> +		(void) ubi_detach_mtd(libubi, args.node, req.mtd_num);
> +		errmsg("Your UBI driver does not allow changing the reserved PEBs count, probably you run an old kernel ? The support was added in kernel version 3.7.");
> +		goto out_libubi;

Here I've removed the ubi_detach_mtd() call and the goto. Since we have
already spent energy for attaching, I think it is nicer to just print a
warning and not detach, and let the user decide if he wants to detach.

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120823/d49e8b25/attachment.sig>


More information about the linux-mtd mailing list