ALSA: usb/6fire: Fix potential NULL pointer dereference in comm.c

'rt' was dereferenced before the NULL check.
Moved the code after the check.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Sachin Kamat 2012-11-21 14:36:57 +05:30 committed by Takashi Iwai
parent 6cf9515207
commit 27b2a22c71
1 changed files with 2 additions and 1 deletions

View File

@ -129,12 +129,13 @@ int __devinit usb6fire_comm_init(struct sfire_chip *chip)
{ {
struct comm_runtime *rt = kzalloc(sizeof(struct comm_runtime), struct comm_runtime *rt = kzalloc(sizeof(struct comm_runtime),
GFP_KERNEL); GFP_KERNEL);
struct urb *urb = &rt->receiver; struct urb *urb;
int ret; int ret;
if (!rt) if (!rt)
return -ENOMEM; return -ENOMEM;
urb = &rt->receiver;
rt->serial = 1; rt->serial = 1;
rt->chip = chip; rt->chip = chip;
usb_init_urb(urb); usb_init_urb(urb);