forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/media/usb/go7007/s2250-board.c
....@@ -1,14 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2008 Sensoray Company Inc.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License (Version 2) as
6
- * published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
124 */
135
146 #include <linux/module.h>
....@@ -512,10 +504,11 @@
512504 u8 *data;
513505 struct go7007 *go = i2c_get_adapdata(adapter);
514506 struct go7007_usb *usb = go->hpi_context;
507
+ int err = -EIO;
515508
516
- audio = i2c_new_dummy(adapter, TLV320_ADDRESS >> 1);
517
- if (audio == NULL)
518
- return -ENOMEM;
509
+ audio = i2c_new_dummy_device(adapter, TLV320_ADDRESS >> 1);
510
+ if (IS_ERR(audio))
511
+ return PTR_ERR(audio);
519512
520513 state = kzalloc(sizeof(struct s2250), GFP_KERNEL);
521514 if (state == NULL) {
....@@ -540,11 +533,8 @@
540533 V4L2_CID_HUE, -512, 511, 1, 0);
541534 sd->ctrl_handler = &state->hdl;
542535 if (state->hdl.error) {
543
- int err = state->hdl.error;
544
-
545
- v4l2_ctrl_handler_free(&state->hdl);
546
- kfree(state);
547
- return err;
536
+ err = state->hdl.error;
537
+ goto fail;
548538 }
549539
550540 state->std = V4L2_STD_NTSC;
....@@ -608,13 +598,14 @@
608598 i2c_unregister_device(audio);
609599 v4l2_ctrl_handler_free(&state->hdl);
610600 kfree(state);
611
- return -EIO;
601
+ return err;
612602 }
613603
614604 static int s2250_remove(struct i2c_client *client)
615605 {
616606 struct s2250 *state = to_state(i2c_get_clientdata(client));
617607
608
+ i2c_unregister_device(state->audio);
618609 v4l2_device_unregister_subdev(&state->sd);
619610 v4l2_ctrl_handler_free(&state->hdl);
620611 kfree(state);