]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/media/i2c/ir-kbd-i2c.c
Merge tag 'trace-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux...
[karo-tx-linux.git] / drivers / media / i2c / ir-kbd-i2c.c
index 8e2f79cb045eabca9ce1686ec853723097daf4e4..82bf5679da3064d5a8ffd9da91c3d9e085d8d8bb 100644 (file)
@@ -295,7 +295,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
        unsigned short addr = client->addr;
        int err;
 
-       ir = kzalloc(sizeof(struct IR_i2c), GFP_KERNEL);
+       ir = devm_kzalloc(&client->dev, sizeof(*ir), GFP_KERNEL);
        if (!ir)
                return -ENOMEM;
 
@@ -398,10 +398,8 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
                 * internally
                 */
                rc = rc_allocate_device();
-               if (!rc) {
-                       err = -ENOMEM;
-                       goto err_out_free;
-               }
+               if (!rc)
+                       return -ENOMEM;
        }
        ir->rc = rc;
 
@@ -454,7 +452,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
  err_out_free:
        /* Only frees rc if it were allocated internally */
        rc_free_device(rc);
-       kfree(ir);
        return err;
 }
 
@@ -470,7 +467,6 @@ static int ir_remove(struct i2c_client *client)
                rc_unregister_device(ir->rc);
 
        /* free memory */
-       kfree(ir);
        return 0;
 }