[marcelo at kvack.org: Re: [PATCH] libertas: fix error handling]

Marcelo Tosatti marcelo at kvack.org
Wed Feb 28 17:16:02 EST 2007


Resending, probably it got dropped.

----- Forwarded message from Marcelo Tosatti <marcelo at kvack.org> -----

From: Marcelo Tosatti <marcelo at kvack.org>
Date: Tue, 27 Feb 2007 22:05:15 -0300
To: Holger Schurig <hs4233 at mail.mn-solutions.de>
Cc: Marcelo Tosatti <marcelo at kvack.org>, libertas-dev at lists.infradead.org
In-Reply-To: <200702270941.33242.hs4233 at mail.mn-solutions.de>
Subject: Re: [PATCH] libertas: fix error handling

Hi Holger,

On Tue, Feb 27, 2007 at 09:41:33AM +0100, Holger Schurig wrote:
> > I understand... But I think its cleaner and less bugprone if
> > we handle errors right at the callers, not later by a common
> > function.
> 
> Okay, then I have to code it with some callback function. 
> Pseudocode follows:
> 
> 
> libertas_add_card(wlan_private *priv,
>                   void (*set_hw_functions)(wlan_private *priv) )
> {
>     if (!set_hw_function)
>         error_out;
> 
>     add-wlan ...
>     if (error)
>        goto error_out2;
> 
>     set_hw_function();
> 
>     activate-card ...
>     if (error) goto error_out_3;
> 
>     return priv;
> 
> error_out3:
>     clean-up-mess-of-activate-card
> error_out2:
>     clean_up_mess-of_add-wlan;
> error_out:
>     return NULL;
> }

Looks good.

> BTW: why do we have a wlan_private and an adapter pointer?  As 
> far as I can see, there is a 1:1 relationship between 
> wlan_private and wlan_adapter, because each 
> wlan_private->adapter points to exactly one adapter.

Yes, thats right. It might be worth merging them together, but maybe not
(both are pretty large already).

----- End forwarded message -----



More information about the libertas-dev mailing list