Re: [PATCH 7/7] staging: rtl8188eu: reduce indentation level in rtw_alloc_stainfo

From: Joe Perches
Date: Sat Oct 26 2019 - 13:19:56 EST


On Sat, 2019-10-26 at 14:11 +0200, Michael Straube wrote:
> Remove else-arm from if-else statement. Move the else code out of the
> if-else and skip it by adding goto exit to the if block. The exit label
> was directly after the else-arm, so there is no change in behaviour.
> Reduces indentation level and clears a line over 80 characters
> checkpatch warning.
[]
> diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
[]
> @@ -181,70 +181,71 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
> struct sta_info, list);
> if (!psta) {
> spin_unlock_bh(&pfree_sta_queue->lock);

Because exit does no cleanup, it's probably simpler as
return NULL;
and then remove the exit label

> + if (index >= NUM_STA) {
> + RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
> + ("ERROR => %s: index >= NUM_STA", __func__));
> + psta = NULL;
> + goto exit;

here too

[]

> +
> exit:
> return psta;
> }