linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rt2x00usb: Fix error return code
@ 2016-08-11 14:38 Christophe JAILLET
  2016-08-11 14:48 ` Stanislaw Gruszka
  2016-09-03 10:07 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2016-08-11 14:38 UTC (permalink / raw)
  To: sgruszka, helmut.schaa, kvalo
  Cc: linux-wireless, linux-kernel, kernel-janitors, Christophe JAILLET

We know that 'retval = 0' because it has been tested a few lines above.
So, if 'devm_kmalloc' fails, 0 will be returned instead of an error code.
Return -ENOMEM instead.

Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
index 7cf26c6124d1..6005e14213ca 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
@@ -831,8 +831,10 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
 	rt2x00dev->anchor = devm_kmalloc(&usb_dev->dev,
 					sizeof(struct usb_anchor),
 					GFP_KERNEL);
-	if (!rt2x00dev->anchor)
+	if (!rt2x00dev->anchor) {
+		retval = -ENOMEM;
 		goto exit_free_reg;
+	}
 
 	init_usb_anchor(rt2x00dev->anchor);
 	return 0;
-- 
2.7.4


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rt2x00usb: Fix error return code
  2016-08-11 14:38 [PATCH] rt2x00usb: Fix error return code Christophe JAILLET
@ 2016-08-11 14:48 ` Stanislaw Gruszka
  2016-09-03 10:07 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Stanislaw Gruszka @ 2016-08-11 14:48 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: helmut.schaa, kvalo, linux-wireless, linux-kernel,
	kernel-janitors

On Thu, Aug 11, 2016 at 04:38:54PM +0200, Christophe JAILLET wrote:
> We know that 'retval = 0' because it has been tested a few lines above.
> So, if 'devm_kmalloc' fails, 0 will be returned instead of an error code.
> Return -ENOMEM instead.
> 
> Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rt2x00usb: Fix error return code
  2016-08-11 14:38 [PATCH] rt2x00usb: Fix error return code Christophe JAILLET
  2016-08-11 14:48 ` Stanislaw Gruszka
@ 2016-09-03 10:07 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2016-09-03 10:07 UTC (permalink / raw)
  To: Christophe Jaillet
  Cc: sgruszka, helmut.schaa, linux-wireless, linux-kernel,
	kernel-janitors, Christophe JAILLET

Christophe Jaillet <christophe.jaillet@wanadoo.fr> wrote:
> We know that 'retval = 0' because it has been tested a few lines above.
> So, if 'devm_kmalloc' fails, 0 will be returned instead of an error code.
> Return -ENOMEM instead.
> 
> Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>

Thanks, 1 patch applied to wireless-drivers-next.git:

410280bac622 rt2x00usb: Fix error return code

-- 
Sent by pwcli
https://patchwork.kernel.org/patch/9275379/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-03 10:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-11 14:38 [PATCH] rt2x00usb: Fix error return code Christophe JAILLET
2016-08-11 14:48 ` Stanislaw Gruszka
2016-09-03 10:07 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).