--- zzzz-none-000/linux-3.10.107/drivers/media/i2c/tw2804.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/i2c/tw2804.c 2021-02-04 17:41:59.000000000 +0000 @@ -23,7 +23,6 @@ #include #include #include -#include #include #define TW2804_REG_AUTOGAIN 0x02 @@ -343,12 +342,12 @@ }; static const struct v4l2_subdev_video_ops tw2804_video_ops = { + .s_std = tw2804_s_std, .s_routing = tw2804_s_video_routing, }; static const struct v4l2_subdev_core_ops tw2804_core_ops = { .log_status = tw2804_log_status, - .s_std = tw2804_s_std, }; static const struct v4l2_subdev_ops tw2804_ops = { @@ -368,8 +367,7 @@ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - state = kzalloc(sizeof(struct tw2804), GFP_KERNEL); - + state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); if (state == NULL) return -ENOMEM; sd = &state->sd; @@ -410,7 +408,6 @@ err = state->hdl.error; if (err) { v4l2_ctrl_handler_free(&state->hdl); - kfree(state); return err; } @@ -427,7 +424,6 @@ v4l2_device_unregister_subdev(sd); v4l2_ctrl_handler_free(&state->hdl); - kfree(state); return 0; }