--- zzzz-none-000/linux-3.10.107/drivers/media/i2c/ov7640.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/i2c/ov7640.c 2021-02-04 17:41:59.000000000 +0000 @@ -20,7 +20,6 @@ #include #include #include -#include #include MODULE_DESCRIPTION("OmniVision ov7640 sensor driver"); @@ -59,7 +58,7 @@ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); + sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); if (sd == NULL) return -ENOMEM; v4l2_i2c_subdev_init(sd, client, &ov7640_ops); @@ -71,7 +70,6 @@ if (write_regs(client, initial_registers) < 0) { v4l_err(client, "error initializing OV7640\n"); - kfree(sd); return -ENODEV; } @@ -84,7 +82,7 @@ struct v4l2_subdev *sd = i2c_get_clientdata(client); v4l2_device_unregister_subdev(sd); - kfree(sd); + return 0; } @@ -96,7 +94,6 @@ static struct i2c_driver ov7640_driver = { .driver = { - .owner = THIS_MODULE, .name = "ov7640", }, .probe = ov7640_probe,