hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/i2c/ir-kbd-i2c.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 *
34 * keyboard input driver for i2c IR remote controls
....@@ -32,17 +33,6 @@
3233 * Mark Weaver <mark@npsl.co.uk>
3334 * Jarod Wilson <jarod@redhat.com>
3435 * Copyright (C) 2011 Andy Walls <awalls@md.metrocast.net>
35
- *
36
- * This program is free software; you can redistribute it and/or modify
37
- * it under the terms of the GNU General Public License as published by
38
- * the Free Software Foundation; either version 2 of the License, or
39
- * (at your option) any later version.
40
- *
41
- * This program is distributed in the hope that it will be useful,
42
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
43
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44
- * GNU General Public License for more details.
45
- *
4636 */
4737
4838 #include <asm/unaligned.h>
....@@ -896,9 +886,11 @@
896886 INIT_DELAYED_WORK(&ir->work, ir_work);
897887
898888 if (probe_tx) {
899
- ir->tx_c = i2c_new_dummy(client->adapter, 0x70);
900
- if (!ir->tx_c) {
889
+ ir->tx_c = i2c_new_dummy_device(client->adapter, 0x70);
890
+ if (IS_ERR(ir->tx_c)) {
901891 dev_err(&client->dev, "failed to setup tx i2c address");
892
+ err = PTR_ERR(ir->tx_c);
893
+ goto err_out_free;
902894 } else if (!zilog_init(ir)) {
903895 ir->carrier = 38000;
904896 ir->duty_cycle = 40;
....@@ -915,7 +907,7 @@
915907 return 0;
916908
917909 err_out_free:
918
- if (ir->tx_c)
910
+ if (!IS_ERR(ir->tx_c))
919911 i2c_unregister_device(ir->tx_c);
920912
921913 /* Only frees rc if it were allocated internally */
....@@ -927,16 +919,12 @@
927919 {
928920 struct IR_i2c *ir = i2c_get_clientdata(client);
929921
930
- /* kill outstanding polls */
931922 cancel_delayed_work_sync(&ir->work);
932923
933
- if (ir->tx_c)
934
- i2c_unregister_device(ir->tx_c);
924
+ i2c_unregister_device(ir->tx_c);
935925
936
- /* unregister device */
937926 rc_unregister_device(ir->rc);
938927
939
- /* free memory */
940928 return 0;
941929 }
942930