[media] RedRat3: Return directly after a failed kcalloc() in redrat3_transmit_ir()
authorMarkus Elfring <elfring@users.sourceforge.net>
Thu, 13 Oct 2016 08:34:29 +0000 (05:34 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 18 Nov 2016 12:50:19 +0000 (10:50 -0200)
* 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: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/redrat3.c

index 342a85d..966f43a 100644 (file)
@@ -777,10 +777,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
        sample_lens = kcalloc(RR3_DRIVER_MAXLENS,
                              sizeof(*sample_lens),
                              GFP_KERNEL);
-       if (!sample_lens) {
-               ret = -ENOMEM;
-               goto out;
-       }
+       if (!sample_lens)
+               return -ENOMEM;
 
        irdata = kzalloc(sizeof(*irdata), GFP_KERNEL);
        if (!irdata) {
@@ -848,8 +846,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
                ret = count;
 
 out:
-       kfree(sample_lens);
        kfree(irdata);
+       kfree(sample_lens);
 
        rr3->transmitting = false;
        /* rr3 re-enables rc detector because it was enabled before */