2006-10-01 15:37:55

by Jeff Garzik

[permalink] [raw]
Subject: [PATCH] drivers/char/ip2: kill unused code, label


Kill warning:

drivers/char/ip2/ip2main.c: In function ‘ip2_loadmain’:
drivers/char/ip2/ip2main.c:782: warning: label ‘out_class’ defined but not used

This driver's initialization (and cleanup of errors during init) is
extremely convoluted, and could stand to be transformed into the
standard unwinding-goto style of error cleanup.

Signed-off-by: Jeff Garzik <[email protected]>

diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 331f447..bcf6573 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -779,8 +779,6 @@ retry:
ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_RETURN, 0 );
goto out;

-out_class:
- class_destroy(ip2_class);
out_chrdev:
unregister_chrdev(IP2_IPL_MAJOR, "ip2");
out:


2006-10-02 00:57:27

by Michael H. Warfield

[permalink] [raw]
Subject: Re: [PATCH] drivers/char/ip2: kill unused code, label

On Sun, 2006-10-01 at 11:37 -0400, Jeff Garzik wrote:
> Kill warning:

> drivers/char/ip2/ip2main.c: In function ‘ip2_loadmain’:
> drivers/char/ip2/ip2main.c:782: warning: label ‘out_class’ defined but not used

> This driver's initialization (and cleanup of errors during init) is
> extremely convoluted, and could stand to be transformed into the
> standard unwinding-goto style of error cleanup.

> Signed-off-by: Jeff Garzik <[email protected]>

Looks good to me. I'll look into the unwinding suggestion.

Signed-off-by: Michael H. Warfield <[email protected]>

> diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
> index 331f447..bcf6573 100644
> --- a/drivers/char/ip2/ip2main.c
> +++ b/drivers/char/ip2/ip2main.c
> @@ -779,8 +779,6 @@ retry:
> ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_RETURN, 0 );
> goto out;
>
> -out_class:
> - class_destroy(ip2_class);
> out_chrdev:
> unregister_chrdev(IP2_IPL_MAJOR, "ip2");
> out:
--
Michael H. Warfield (AI4NB) | (770) 985-6132 | [email protected]
/\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/
NIC whois: MHW9 | An optimist believes we live in the best of all
PGP Key: 0xDF1DD471 | possible worlds. A pessimist is sure of it!


Attachments:
signature.asc (307.00 B)
This is a digitally signed message part