mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: Vihas Mak <makvihas@gmail.com>,
	Larry.Finger@lwfinger.net, phil@philpotter.co.uk,
	gregkh@linuxfoundation.org, martin@kaiser.cx,
	straube.linux@gmail.com
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: r8188eu: handle rtw_init_netdev_name() failure appropriately
Date: Mon, 17 Jan 2022 00:47:03 +0300	[thread overview]
Message-ID: <c908c21f-1de3-cb70-7694-54b3db669da6@gmail.com> (raw)
In-Reply-To: <20220116192611.19224-1-makvihas@gmail.com>

Hi Vihas,

On 1/16/22 22:26, Vihas Mak wrote:
> rtw_init_netdev_name() calls dev_alloc_name() which allocates the name
> for the device as per the given name format.
> It returns a negative err code if the format is invalid. Currently the
> name format is specified by the module parameter "ifname".
> Warn the user if "ifname" is invalid.
> 
> Signed-off-by: Vihas Mak <makvihas@gmail.com>
> ---
>   drivers/staging/r8188eu/os_dep/usb_intf.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
> index 91792dfd3..875815b5e 100644
> --- a/drivers/staging/r8188eu/os_dep/usb_intf.c
> +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
> @@ -399,7 +399,10 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
>   			DBG_88E("can't get autopm:\n");
>   
>   	/*  alloc dev name after read efuse. */
> -	rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname);
> +	if (rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname) < 0) {
> +		DBG_88E("rtw_init_netdev_name failed, ifname:%s\n",
> +			padapter->registrypriv.ifname);
> +	}
>   	rtw_macaddr_cfg(padapter->eeprompriv.mac_addr);
>   	rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr,
>   				  padapter->eeprompriv.mac_addr);

rtw_init_netdev_name() has an error message in case of allocation 
failure. It looks like it's better to handle the error normally and pass 
it to caller




With regards,
Pavel Skripkin

  reply	other threads:[~2022-01-16 21:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-16 19:26 Vihas Mak
2022-01-16 21:47 ` Pavel Skripkin [this message]
2022-01-17  4:05   ` Vihas Mak
2022-01-18 15:07 ` Dan Carpenter
2022-01-20 12:28   ` Vihas Mak

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=c908c21f-1de3-cb70-7694-54b3db669da6@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=makvihas@gmail.com \
    --cc=martin@kaiser.cx \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@gmail.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

all inboxes | Powered by JetHome®