All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Ortiz <samuel@sortiz.org>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] irlan: handle out of memory errors
Date: Wed, 20 Dec 2006 00:47:26 +0200	[thread overview]
Message-ID: <20061219224726.GC4274@sortiz.org> (raw)
In-Reply-To: <20061219085601.GL4049@APFDCB5C>

On Tue, Dec 19, 2006 at 05:56:01PM +0900, Akinobu Mita wrote:
> This patch checks return values:
> 
> - irlmp_register_client()
> - irlmp_register_service()
> - irlan_open()
> 
> Cc: Samuel Ortiz <samuel@sortiz.org>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
This one seems correct as well, thanks again.

Signed-off-by: Samuel Ortiz <samuel@sortiz.org>

Cheers,
Samuel.


> 
> ---
>  net/irda/irlan/irlan_common.c |   23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)
> 
> Index: 2.6-mm/net/irda/irlan/irlan_common.c
> ===================================================================
> --- 2.6-mm.orig/net/irda/irlan/irlan_common.c
> +++ 2.6-mm/net/irda/irlan/irlan_common.c
> @@ -144,12 +144,18 @@ static int __init irlan_init(void)
>  	/* Register with IrLMP as a client */
>  	ckey = irlmp_register_client(hints, &irlan_client_discovery_indication,
>  				     NULL, NULL);
> -	
> +	if (!ckey)
> +		goto err_ckey;
> +
>  	/* Register with IrLMP as a service */
> - 	skey = irlmp_register_service(hints);
> +	skey = irlmp_register_service(hints);
> +	if (!skey)
> +		goto err_skey;
>  
>  	/* Start the master IrLAN instance (the only one for now) */
> - 	new = irlan_open(DEV_ADDR_ANY, DEV_ADDR_ANY);
> +	new = irlan_open(DEV_ADDR_ANY, DEV_ADDR_ANY);
> +	if (!new)
> +		goto err_open;
>  
>  	/* The master will only open its (listen) control TSAP */
>  	irlan_provider_open_ctrl_tsap(new);
> @@ -158,6 +164,17 @@ static int __init irlan_init(void)
>  	irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS);
>  
>  	return 0;
> +
> +err_open:
> +	irlmp_unregister_service(skey);
> +err_skey:
> +	irlmp_unregister_client(ckey);
> +err_ckey:
> +#ifdef CONFIG_PROC_FS
> +	remove_proc_entry("irlan", proc_irda);
> +#endif /* CONFIG_PROC_FS */
> +
> +	return -ENOMEM;
>  }
>  
>  static void __exit irlan_cleanup(void) 

  reply	other threads:[~2006-12-19 23:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-19  8:56 [PATCH] irlan: handle out of memory errors Akinobu Mita
2006-12-19 22:47 ` Samuel Ortiz [this message]
2007-02-07  8:12   ` David Miller
2007-02-07 10:59     ` [PATCH] NET : change layout of ehash table Eric Dumazet
2007-02-08 22:56       ` David Miller
2007-02-09  9:18         ` Andi Kleen
2007-02-09  8:40           ` David Miller
2007-02-09  8:57             ` Andi Kleen
2007-02-09  9:06             ` Eric Dumazet
2007-02-09  9:15               ` David Miller
2007-02-09  9:36                 ` Eric Dumazet
2007-02-09  9:43                   ` David Miller
2007-02-09 10:10                     ` Andi Kleen
2007-02-09 17:44                     ` [PATCH] NET : UDP can use sk_hash to speedup lookups Eric Dumazet
2007-02-09 23:45                       ` David Miller

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=20061219224726.GC4274@sortiz.org \
    --to=samuel@sortiz.org \
    --cc=akinobu.mita@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@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.