All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Nils Radtke <lkml@Think-Future.com>
Cc: gregkh@suse.de, kernel-janitors@vger.kernel.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: wlan-ng: p80211netdev.c cleanup
Date: Sun, 19 Sep 2010 12:40:31 +0000	[thread overview]
Message-ID: <4C9604BF.1090809@bfs.de> (raw)
In-Reply-To: <1284834652-26171-1-git-send-email-lkml@Think-Future.com>



Nils Radtke schrieb:
> Effected preliminary cleanup lead by the idea of kerneljanitor.org .
> As recommended I'm asking for approval of the location of cleanup
> and the manner it happened to know I'm heading in the right
> direction.
> 
> Compiles. Not tested.
> 
> Signed-off-by: Nils Radtke <lkml@Think-Future.com>
> ---
>  drivers/staging/wlan-ng/p80211netdev.c |   50 +++++++++++++++++++-------------
>  1 files changed, 30 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
> index aa1792c..8104e11 100644
> --- a/drivers/staging/wlan-ng/p80211netdev.c
> +++ b/drivers/staging/wlan-ng/p80211netdev.c
> @@ -176,25 +176,30 @@ static struct net_device_stats *p80211knetdev_get_stats(netdevice_t * netdev)
>  ----------------------------------------------------------------*/
>  static int p80211knetdev_open(netdevice_t *netdev)
>  {
> -	int result = 0;		/* success */
> +	int ret = 0;
>  	wlandevice_t *wlandev = netdev->ml_priv;
>  
>  	/* Check to make sure the MSD is running */
> -	if (wlandev->msdstate != WLAN_MSD_RUNNING)
> -		return -ENODEV;
> +	if (wlandev->msdstate != WLAN_MSD_RUNNING) {
> +		ret = -ENODEV;
> +		goto end;
> +	}
>  
>  	/* Tell the MSD to open */
> -	if (wlandev->open != NULL) {
> -		result = wlandev->open(wlandev);
> -		if (result = 0) {
> -			netif_start_queue(wlandev->netdev);
> -			wlandev->state = WLAN_DEVICE_OPEN;
> -		}
> -	} else {
> -		result = -EAGAIN;
> +	if (wlandev->open = NULL) {
> +		printk(KERN_ERR "Sorry, got wlandev->open = NULL.\n");
> +		ret = -EAGAIN;
> +		goto end;
>  	}
>  
> -	return result;
> +	ret = wlandev->open(wlandev);
> +	if (ret) {
> +		netif_start_queue(wlandev->netdev);
> +		wlandev->state = WLAN_DEVICE_OPEN;
> +	}
> +
> +end:
> +	return ret;
>  }
>  

unwinding is always good :)





>  /*----------------------------------------------------------------
> @@ -211,16 +216,23 @@ static int p80211knetdev_open(netdevice_t *netdev)
>  ----------------------------------------------------------------*/
>  static int p80211knetdev_stop(netdevice_t *netdev)
>  {
> -	int result = 0;
> +	int ret = -EFAULT;
>  	wlandevice_t *wlandev = netdev->ml_priv;
>  
> -	if (wlandev->close != NULL)
> -		result = wlandev->close(wlandev);
> +	if (wlandev->close = NULL) {
> +		printk(KERN_ERR "Sorry, got wlandev->close = NULL.\n");
> +		ret = -EFAULT; /* FIXME: nr: correct return code? */
> +		goto end;
> +	}
>  
> -	netif_stop_queue(wlandev->netdev);
> -	wlandev->state = WLAN_DEVICE_CLOSED;
> +	ret = wlandev->close(wlandev);
> +	if (ret) {
> +		netif_stop_queue(wlandev->netdev);
> +		wlandev->state = WLAN_DEVICE_CLOSED;
> +	}
>  
> -	return result;
> +end:
> +	return ret;
>  }
>  

but i wonder if the the test for wlandev->open in X_close() is needed
can wlandev->close vanish between open() and stop() ?

I am wondering who to use the error message "Sorry, got wlandev->open = NULL"
is true but what help ? Give the reader a change and add __func__ to figure out
what hit him.

re,
 wh


>  /*----------------------------------------------------------------
> @@ -242,8 +254,6 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
>  	skb_queue_tail(&wlandev->nsd_rxq, skb);
>  
>  	tasklet_schedule(&wlandev->rx_bh);
> -
> -	return;
>  }
>  
>  /*----------------------------------------------------------------

WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Nils Radtke <lkml@Think-Future.com>
Cc: gregkh@suse.de, kernel-janitors@vger.kernel.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: wlan-ng: p80211netdev.c cleanup
Date: Sun, 19 Sep 2010 14:40:31 +0200	[thread overview]
Message-ID: <4C9604BF.1090809@bfs.de> (raw)
In-Reply-To: <1284834652-26171-1-git-send-email-lkml@Think-Future.com>



Nils Radtke schrieb:
> Effected preliminary cleanup lead by the idea of kerneljanitor.org .
> As recommended I'm asking for approval of the location of cleanup
> and the manner it happened to know I'm heading in the right
> direction.
> 
> Compiles. Not tested.
> 
> Signed-off-by: Nils Radtke <lkml@Think-Future.com>
> ---
>  drivers/staging/wlan-ng/p80211netdev.c |   50 +++++++++++++++++++-------------
>  1 files changed, 30 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
> index aa1792c..8104e11 100644
> --- a/drivers/staging/wlan-ng/p80211netdev.c
> +++ b/drivers/staging/wlan-ng/p80211netdev.c
> @@ -176,25 +176,30 @@ static struct net_device_stats *p80211knetdev_get_stats(netdevice_t * netdev)
>  ----------------------------------------------------------------*/
>  static int p80211knetdev_open(netdevice_t *netdev)
>  {
> -	int result = 0;		/* success */
> +	int ret = 0;
>  	wlandevice_t *wlandev = netdev->ml_priv;
>  
>  	/* Check to make sure the MSD is running */
> -	if (wlandev->msdstate != WLAN_MSD_RUNNING)
> -		return -ENODEV;
> +	if (wlandev->msdstate != WLAN_MSD_RUNNING) {
> +		ret = -ENODEV;
> +		goto end;
> +	}
>  
>  	/* Tell the MSD to open */
> -	if (wlandev->open != NULL) {
> -		result = wlandev->open(wlandev);
> -		if (result == 0) {
> -			netif_start_queue(wlandev->netdev);
> -			wlandev->state = WLAN_DEVICE_OPEN;
> -		}
> -	} else {
> -		result = -EAGAIN;
> +	if (wlandev->open == NULL) {
> +		printk(KERN_ERR "Sorry, got wlandev->open == NULL.\n");
> +		ret = -EAGAIN;
> +		goto end;
>  	}
>  
> -	return result;
> +	ret = wlandev->open(wlandev);
> +	if (ret) {
> +		netif_start_queue(wlandev->netdev);
> +		wlandev->state = WLAN_DEVICE_OPEN;
> +	}
> +
> +end:
> +	return ret;
>  }
>  

unwinding is always good :)





>  /*----------------------------------------------------------------
> @@ -211,16 +216,23 @@ static int p80211knetdev_open(netdevice_t *netdev)
>  ----------------------------------------------------------------*/
>  static int p80211knetdev_stop(netdevice_t *netdev)
>  {
> -	int result = 0;
> +	int ret = -EFAULT;
>  	wlandevice_t *wlandev = netdev->ml_priv;
>  
> -	if (wlandev->close != NULL)
> -		result = wlandev->close(wlandev);
> +	if (wlandev->close == NULL) {
> +		printk(KERN_ERR "Sorry, got wlandev->close == NULL.\n");
> +		ret = -EFAULT; /* FIXME: nr: correct return code? */
> +		goto end;
> +	}
>  
> -	netif_stop_queue(wlandev->netdev);
> -	wlandev->state = WLAN_DEVICE_CLOSED;
> +	ret = wlandev->close(wlandev);
> +	if (ret) {
> +		netif_stop_queue(wlandev->netdev);
> +		wlandev->state = WLAN_DEVICE_CLOSED;
> +	}
>  
> -	return result;
> +end:
> +	return ret;
>  }
>  

but i wonder if the the test for wlandev->open in X_close() is needed
can wlandev->close vanish between open() and stop() ?

I am wondering who to use the error message "Sorry, got wlandev->open == NULL"
is true but what help ? Give the reader a change and add __func__ to figure out
what hit him.

re,
 wh


>  /*----------------------------------------------------------------
> @@ -242,8 +254,6 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
>  	skb_queue_tail(&wlandev->nsd_rxq, skb);
>  
>  	tasklet_schedule(&wlandev->rx_bh);
> -
> -	return;
>  }
>  
>  /*----------------------------------------------------------------

  parent reply	other threads:[~2010-09-19 12:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-18 18:30 [PATCH] Staging: wlan-ng: p80211netdev.c cleanup Nils Radtke
2010-09-18 18:30 ` Nils Radtke
2010-09-18 20:41 ` Dan Carpenter
2010-09-18 20:41   ` Dan Carpenter
2010-11-17 14:55   ` Nils Radtke
2010-11-17 14:55     ` Nils Radtke
2010-11-17 21:32     ` Dan Carpenter
2010-11-17 21:32       ` Dan Carpenter
2010-11-18 10:31       ` Nils Radtke
2010-11-18 10:31         ` Nils Radtke
2010-09-19 12:40 ` walter harms [this message]
2010-09-19 12:40   ` walter harms
2010-09-21  0:07 ` Greg KH
2010-09-21  0:07   ` Greg KH

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=4C9604BF.1090809@bfs.de \
    --to=wharms@bfs.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@Think-Future.com \
    /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.