[PATCH 11/18] Virtex: Port UARTLITE driver to of-platform-bus
Arnd Bergmann
arnd at arndb.de
Sat Sep 29 05:32:17 EST 2007
On Friday 28 September 2007, Grant Likely wrote:
> - ret = uart_register_driver(&ulite_uart_driver);
> - if (ret)
> - return ret;
> + pr_debug("uartlite: calling uart_register_driver()\n");
> + if ((ret = uart_register_driver(&ulite_uart_driver)) != 0)
> + goto err_uart;
>
> - ret = platform_driver_register(&ulite_platform_driver);
> - if (ret)
> - uart_unregister_driver(&ulite_uart_driver);
> + if ((ret = ulite_of_register()) != 0)
> + goto err_of;
>
> + pr_debug("uartlite: calling platform_driver_register()\n");
> + if ((ret = platform_driver_register(&ulite_platform_driver)) != 0)
> + goto err_plat;
> +
> + return 0;
I don't see this as much of an improvement. Doing an assignment in the
condition makes the code less readable IMHO, so it should really
be written as
ret = try_something();
if (ret)
goto something_failed;
This keeps the normal code to the left, and the error handling indented
to the right.
Arnd <><
More information about the Linuxppc-dev
mailing list