Re: [PATCH 14/14] zorro: fix device_register() error handling

From: Geert Uytterhoeven
Date: Thu Sep 30 2010 - 15:41:49 EST


On Sun, Sep 19, 2010 at 14:55, Vasiliy Kulikov <segooon@xxxxxxxxx> wrote:
> If device_register() fails then call put_device().
> See comment to device_register.
>
> Signed-off-by: Vasiliy Kulikov <segooon@xxxxxxxxx>

Thanks, applied to m68k tree, queued for 2.6.37.

> ---
> ÂI cannot compile this driver, so it is not tested at all.
>
> Âdrivers/zorro/zorro.c | Â Â2 ++
> Â1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
> index 6455f3a..e0c2807 100644
> --- a/drivers/zorro/zorro.c
> +++ b/drivers/zorro/zorro.c
> @@ -142,6 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
> Â Â Â Âerror = device_register(&bus->dev);
> Â Â Â Âif (error) {
> Â Â Â Â Â Â Â Âpr_err("Zorro: Error registering zorro_bus\n");
> + Â Â Â Â Â Â Â put_device(&bus->dev);
> Â Â Â Â Â Â Â Âkfree(bus);
> Â Â Â Â Â Â Â Âreturn error;
> Â Â Â Â}
> @@ -175,6 +176,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
> Â Â Â Â Â Â Â Âif (error) {
> Â Â Â Â Â Â Â Â Â Â Â Âdev_err(&bus->dev, "Error registering device %s\n",
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âz->name);
> + Â Â Â Â Â Â Â Â Â Â Â put_device(&z->dev);
> Â Â Â Â Â Â Â Â Â Â Â Âcontinue;
> Â Â Â Â Â Â Â Â}
> Â Â Â Â Â Â Â Âerror = zorro_create_sysfs_dev_files(z);
> --
> 1.7.0.4

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/