lkml.org 
[lkml]   [2021]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH -next v2] staging: rtl8192e: rtllib_module: fix missing free_netdev() on error in alloc_rtllib()
I just sent an reply to the v1 patch with more explanations.

On Wed, Dec 01, 2021 at 02:29:08PM +0800, Yang Yingliang wrote:
> diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c
> index 64d9feee1f39..105c58e749d6 100644
> --- a/drivers/staging/rtl8192e/rtllib_module.c
> +++ b/drivers/staging/rtl8192e/rtllib_module.c
> @@ -121,11 +121,12 @@ struct net_device *alloc_rtllib(int sizeof_priv)
> ieee->hwsec_active = 0;
>
> memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32);
> - rtllib_softmac_init(ieee);
> + if (rtllib_softmac_init(ieee))
> + goto failed;

Please write this like so:

err = rtllib_softmac_init(ieee);
if (err)
goto failed;

Otherwise it suggests that rtllib_softmac_init() returns boolean or
something. I suggest changing rtllib_softmac_init() in a separate
patch 2/2.

> @@ -2962,8 +2962,10 @@ void rtllib_softmac_init(struct rtllib_device *ieee)
> for (i = 0; i < 5; i++)
> ieee->seq_ctrl[i] = 0;
> ieee->dot11d_info = kzalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC);
> - if (!ieee->dot11d_info)
> + if (!ieee->dot11d_info) {
> netdev_err(ieee->dev, "Can't alloc memory for DOT11D\n");

This error message should be deleted. The kzalloc() function already
has a more useful message.

> + return -ENOMEM;
> + }
> ieee->LinkDetectInfo.SlotIndex = 0;
> ieee->LinkDetectInfo.SlotNum = 2;
> ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0;

regards,
dan carpenter

\
 
 \ /
  Last update: 2021-12-01 08:05    [W:0.036 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site