Commit 657d4c86 authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Greg Kroah-Hartman
Browse files

staging: wlags49_h2: fix error handling in pcmcia probe function



wl_adapter_attach() ignores some important issues
such as register_netdev() failure. The patch fixes it.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d1d2f83f
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -133,6 +133,7 @@ static int wl_adapter_attach(struct pcmcia_device *link)
{
{
	struct net_device   *dev;
	struct net_device   *dev;
	struct wl_private   *lp;
	struct wl_private   *lp;
	int ret;
	/*--------------------------------------------------------------------*/
	/*--------------------------------------------------------------------*/


	DBG_FUNC("wl_adapter_attach");
	DBG_FUNC("wl_adapter_attach");
@@ -154,10 +155,12 @@ static int wl_adapter_attach(struct pcmcia_device *link)
	lp = wl_priv(dev);
	lp = wl_priv(dev);
	lp->link = link;
	lp->link = link;


	wl_adapter_insert(link);
	ret = wl_adapter_insert(link);
	if (ret != 0)
		wl_device_dealloc(dev);


	DBG_LEAVE(DbgInfo);
	DBG_LEAVE(DbgInfo);
	return 0;
	return ret;
} /* wl_adapter_attach */
} /* wl_adapter_attach */
/*============================================================================*/
/*============================================================================*/


@@ -224,7 +227,7 @@ static int wl_adapter_resume(struct pcmcia_device *link)
	return 0;
	return 0;
} /* wl_adapter_resume */
} /* wl_adapter_resume */


void wl_adapter_insert(struct pcmcia_device *link)
int wl_adapter_insert(struct pcmcia_device *link)
{
{
	struct net_device *dev;
	struct net_device *dev;
	int ret;
	int ret;
@@ -267,13 +270,13 @@ void wl_adapter_insert(struct pcmcia_device *link)
		" %pM\n", dev->name, dev->base_addr, dev->irq, dev->dev_addr);
		" %pM\n", dev->name, dev->base_addr, dev->irq, dev->dev_addr);


	DBG_LEAVE(DbgInfo);
	DBG_LEAVE(DbgInfo);
	return;
	return 0;


failed:
failed:
	wl_adapter_release(link);
	wl_adapter_release(link);


	DBG_LEAVE(DbgInfo);
	DBG_LEAVE(DbgInfo);
	return;
	return ret;
} /* wl_adapter_insert */
} /* wl_adapter_insert */
/*============================================================================*/
/*============================================================================*/


+2 −2
Original line number Original line Diff line number Diff line
@@ -65,10 +65,10 @@




/*******************************************************************************
/*******************************************************************************
 *  function protoypes
 *  function prototypes
 ******************************************************************************/
 ******************************************************************************/


void wl_adapter_insert(struct pcmcia_device *link);
int wl_adapter_insert(struct pcmcia_device *link);


void wl_adapter_release(struct pcmcia_device *link);
void wl_adapter_release(struct pcmcia_device *link);