hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/i2c/busses/i2c-tiny-usb.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * driver for the i2c-tiny-usb adapter - 1.0
34 * http://www.harbaum.org/till/i2c_tiny_usb
45 *
56 * Copyright (C) 2006-2007 Till Harbaum (Till@Harbaum.org)
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License as
9
- * published by the Free Software Foundation, version 2.
10
- *
117 */
128
139 #include <linux/kernel.h>
....@@ -88,7 +84,7 @@
8884 pmsg->buf, pmsg->len) != pmsg->len) {
8985 dev_err(&adapter->dev,
9086 "failure reading data\n");
91
- ret = -EREMOTEIO;
87
+ ret = -EIO;
9288 goto out;
9389 }
9490 } else {
....@@ -98,7 +94,7 @@
9894 pmsg->buf, pmsg->len) != pmsg->len) {
9995 dev_err(&adapter->dev,
10096 "failure writing data\n");
101
- ret = -EREMOTEIO;
97
+ ret = -EIO;
10298 goto out;
10399 }
104100 }
....@@ -106,13 +102,13 @@
106102 /* read status */
107103 if (usb_read(adapter, CMD_GET_STATUS, 0, 0, pstatus, 1) != 1) {
108104 dev_err(&adapter->dev, "failure reading status\n");
109
- ret = -EREMOTEIO;
105
+ ret = -EIO;
110106 goto out;
111107 }
112108
113109 dev_dbg(&adapter->dev, " status = %d\n", *pstatus);
114110 if (*pstatus == STATUS_ADDRESS_NAK) {
115
- ret = -EREMOTEIO;
111
+ ret = -ENXIO;
116112 goto out;
117113 }
118114 }
....@@ -230,10 +226,8 @@
230226
231227 /* allocate memory for our device state and initialize it */
232228 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
233
- if (dev == NULL) {
234
- dev_err(&interface->dev, "Out of memory\n");
229
+ if (!dev)
235230 goto error;
236
- }
237231
238232 dev->usb_dev = usb_get_dev(interface_to_usbdev(interface));
239233 dev->interface = interface;