.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * 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. |
---|
12 | 4 | */ |
---|
13 | 5 | |
---|
14 | 6 | #include <linux/module.h> |
---|
.. | .. |
---|
512 | 504 | u8 *data; |
---|
513 | 505 | struct go7007 *go = i2c_get_adapdata(adapter); |
---|
514 | 506 | struct go7007_usb *usb = go->hpi_context; |
---|
| 507 | + int err = -EIO; |
---|
515 | 508 | |
---|
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); |
---|
519 | 512 | |
---|
520 | 513 | state = kzalloc(sizeof(struct s2250), GFP_KERNEL); |
---|
521 | 514 | if (state == NULL) { |
---|
.. | .. |
---|
540 | 533 | V4L2_CID_HUE, -512, 511, 1, 0); |
---|
541 | 534 | sd->ctrl_handler = &state->hdl; |
---|
542 | 535 | 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; |
---|
548 | 538 | } |
---|
549 | 539 | |
---|
550 | 540 | state->std = V4L2_STD_NTSC; |
---|
.. | .. |
---|
608 | 598 | i2c_unregister_device(audio); |
---|
609 | 599 | v4l2_ctrl_handler_free(&state->hdl); |
---|
610 | 600 | kfree(state); |
---|
611 | | - return -EIO; |
---|
| 601 | + return err; |
---|
612 | 602 | } |
---|
613 | 603 | |
---|
614 | 604 | static int s2250_remove(struct i2c_client *client) |
---|
615 | 605 | { |
---|
616 | 606 | struct s2250 *state = to_state(i2c_get_clientdata(client)); |
---|
617 | 607 | |
---|
| 608 | + i2c_unregister_device(state->audio); |
---|
618 | 609 | v4l2_device_unregister_subdev(&state->sd); |
---|
619 | 610 | v4l2_ctrl_handler_free(&state->hdl); |
---|
620 | 611 | kfree(state); |
---|