From: Dan Carpenter <dan.carpenter@oracle.com>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev,
gregkh@linuxfoundation.org, paskripkin@gmail.com
Subject: Re: [PATCH -next v2] staging: rtl8192e: rtllib_module: fix missing free_netdev() on error in alloc_rtllib()
Date: Wed, 1 Dec 2021 10:04:57 +0300 [thread overview]
Message-ID: <20211201070457.GD9522@kadam> (raw)
In-Reply-To: <20211201062908.1656422-1-yangyingliang@huawei.com>
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
prev parent reply other threads:[~2021-12-01 7:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-01 6:29 [PATCH -next v2] staging: rtl8192e: rtllib_module: fix missing free_netdev() on error in alloc_rtllib() Yang Yingliang
2021-12-01 7:04 ` Dan Carpenter [this message]
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=20211201070457.GD9522@kadam \
--to=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=paskripkin@gmail.com \
--cc=yangyingliang@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox