Commit fac59136 authored by Markus Elfring's avatar Markus Elfring Committed by Mauro Carvalho Chehab

[media] RedRat3: Return directly after a failed kcalloc() in redrat3_transmit_ir()

* Return directly after a call of the function "kcalloc" failed
  at the beginning.

* Reorder two calls for the function "kfree" at the end.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 576df632
...@@ -777,10 +777,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, ...@@ -777,10 +777,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
sample_lens = kcalloc(RR3_DRIVER_MAXLENS, sample_lens = kcalloc(RR3_DRIVER_MAXLENS,
sizeof(*sample_lens), sizeof(*sample_lens),
GFP_KERNEL); GFP_KERNEL);
if (!sample_lens) { if (!sample_lens)
ret = -ENOMEM; return -ENOMEM;
goto out;
}
irdata = kzalloc(sizeof(*irdata), GFP_KERNEL); irdata = kzalloc(sizeof(*irdata), GFP_KERNEL);
if (!irdata) { if (!irdata) {
...@@ -848,8 +846,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, ...@@ -848,8 +846,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
ret = count; ret = count;
out: out:
kfree(sample_lens);
kfree(irdata); kfree(irdata);
kfree(sample_lens);
rr3->transmitting = false; rr3->transmitting = false;
/* rr3 re-enables rc detector because it was enabled before */ /* rr3 re-enables rc detector because it was enabled before */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment