All of lore.kernel.org
 help / color / mirror / Atom feed
From: Domen Puncer <domen@coderock.org>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH] Fix GCC warning: unused variable
Date: Tue, 28 Jun 2005 13:55:08 +0000	[thread overview]
Message-ID: <20050628135508.GC3904@nd47.coderock.org> (raw)
In-Reply-To: <42BC618D.7070704@cs.pdx.edu>

[-- Attachment #1: Type: text/plain, Size: 1689 bytes --]

On 24/06/05 12:39 -0700, Jesse Millan wrote:
> 
> This function will return either 'eisacount', 'pcicount' or 0. Because
> of the control flow, one, or both the variables will be unused.
> Replacing them with one generic variable 'count' instead of the two is
> more efficient and eliminates the unused variable warning.
> 

> Signed-off-by: Jesse Millan <jessem@cs.pdx.edu>
> 
> --- linux-2.6.12-rc6.kj/drivers/net/dgrs.c~	2005-06-24 12:05:17.748053320 -0700
> +++ linux-2.6.12-rc6.kj/drivers/net/dgrs.c	2005-06-24 12:20:34.474689688 -0700
> @@ -1549,7 +1549,7 @@ MODULE_PARM_DESC(nicmode, "Digi RightSwi
>  static int __init dgrs_init_module (void)
>  {
>  	int	i;
> -	int eisacount = 0, pcicount = 0;
> +	int count = 0;
> 
>  	/*
>  	 *	Command line variable overrides
> @@ -1591,14 +1591,14 @@ static int __init dgrs_init_module (void
>  	 *	Find and configure all the cards
>  	 */
>  #ifdef CONFIG_EISA
> -	eisacount = eisa_driver_register(&dgrs_eisa_driver);
> -	if (eisacount < 0)
> -		return eisacount;
> +	count = eisa_driver_register(&dgrs_eisa_driver);
> +	if (count < 0)
> +		return count;
>  #endif
>  #ifdef CONFIG_PCI
> -	pcicount = pci_register_driver(&dgrs_pci_driver);
> -	if (pcicount)
> -		return pcicount;
> +	count = pci_register_driver(&dgrs_pci_driver);
> +	if (count)
> +		return count;
>  #endif
>  	return 0;
>  }

'count' seems a bit misleading, it doesn't count anything.
And I don't quite get the logic of this:
  If we don't have EISA nor PCI support compiled in we succeed.
  If we have support for both, but only succeed to register one
  (i.e. because we don't have a pci bus), we fail.

CONFIG_PCI ifdef seems undeeded, there's a stub version in pci.h.

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

      reply	other threads:[~2005-06-28 13:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-24 19:39 [KJ] [PATCH] Fix GCC warning: unused variable Jesse Millan
2005-06-28 13:55 ` Domen Puncer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050628135508.GC3904@nd47.coderock.org \
    --to=domen@coderock.org \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.