mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Zwane Mwaikambo <zwane@linuxpower.ca>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][2.5] xircom_cb release memory on failure
Date: Mon, 07 Apr 2003 19:14:20 -0400	[thread overview]
Message-ID: <3E92064C.9080306@pobox.com> (raw)
In-Reply-To: <Pine.LNX.4.50.0304061635500.2268-100000@montezuma.mastecende.com>

Zwane Mwaikambo wrote:
> This patch switches free'ing to pci_free_consistent and fixes a memory 
> leak plus a few small cleanups.
> 
> Index: linux-2.5.66/drivers/net/tulip/xircom_cb.c
> ===================================================================
> RCS file: /build/cvsroot/linux-2.5.66/drivers/net/tulip/xircom_cb.c,v
> retrieving revision 1.1.1.1
> diff -u -p -B -r1.1.1.1 xircom_cb.c
> --- linux-2.5.66/drivers/net/tulip/xircom_cb.c	24 Mar 2003 23:39:20 -0000	1.1.1.1
> +++ linux-2.5.66/drivers/net/tulip/xircom_cb.c	6 Apr 2003 20:25:44 -0000
> @@ -73,6 +73,8 @@ MODULE_LICENSE("GPL");
>  /* Offsets of the buffers within the descriptor pages, in bytes */
>  
>  #define NUMDESCRIPTORS 4
> +#define RX_BUF_SIZE	8192
> +#define TX_BUF_SIZE	8192
>  
>  static int bufferoffsets[NUMDESCRIPTORS] = {128,2048,4096,6144};
>  
> @@ -96,7 +98,7 @@ struct xircom_private {
>  	int transmit_used;
>  
>  	/* Spinlock to serialize register operations.
> -	   It must be helt while manipulating the following registers:
> +	   It must be held whilst manipulating the following registers:
>  	   CSR0, CSR6, CSR7, CSR9, CSR10, CSR15
>  	 */
>  	spinlock_t lock;
> @@ -220,12 +222,13 @@ static int __devinit xircom_probe(struct
>  	unsigned char chip_rev;
>  	unsigned long flags;
>  	unsigned short tmp16;
> +	int ret = -EIO;
>  	enter("xircom_probe");
>  	
>  	/* First do the PCI initialisation */
>  
>  	if (pci_enable_device(pdev))
> -		return -ENODEV;
> +		goto out;

regression: no longer calls leave() as intended


>  
>  	/* disable all powermanagement */
>  	pci_write_config_dword(pdev, PCI_POWERMGMT, 0x0000);
> @@ -250,30 +254,27 @@ static int __devinit xircom_probe(struct
>  	   is available. 
>  	 */
>  	private = kmalloc(sizeof(*private),GFP_KERNEL);
> -	memset(private, 0, sizeof(struct xircom_private));
> +	if (private == NULL)
> +		goto out_region;
> +
> +	memset(private, 0, sizeof(*private));

see davej's patches -- not needed.  get alloc_etherdev() to allocate and 
free dev->priv, and eliminate this memset altogether.  That in turn 
simplifies what you are trying to do here.

	Jeff




  reply	other threads:[~2003-04-07 23:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-06 20:40 Zwane Mwaikambo
2003-04-07 23:14 ` Jeff Garzik [this message]
2003-04-08  2:05   ` Zwane Mwaikambo

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=3E92064C.9080306@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zwane@linuxpower.ca \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®