| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * driver for the i2c-tiny-usb adapter - 1.0 |
|---|
| 3 | 4 | * http://www.harbaum.org/till/i2c_tiny_usb |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * 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 | | - * |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | |
|---|
| 13 | 9 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 88 | 84 | pmsg->buf, pmsg->len) != pmsg->len) { |
|---|
| 89 | 85 | dev_err(&adapter->dev, |
|---|
| 90 | 86 | "failure reading data\n"); |
|---|
| 91 | | - ret = -EREMOTEIO; |
|---|
| 87 | + ret = -EIO; |
|---|
| 92 | 88 | goto out; |
|---|
| 93 | 89 | } |
|---|
| 94 | 90 | } else { |
|---|
| .. | .. |
|---|
| 98 | 94 | pmsg->buf, pmsg->len) != pmsg->len) { |
|---|
| 99 | 95 | dev_err(&adapter->dev, |
|---|
| 100 | 96 | "failure writing data\n"); |
|---|
| 101 | | - ret = -EREMOTEIO; |
|---|
| 97 | + ret = -EIO; |
|---|
| 102 | 98 | goto out; |
|---|
| 103 | 99 | } |
|---|
| 104 | 100 | } |
|---|
| .. | .. |
|---|
| 106 | 102 | /* read status */ |
|---|
| 107 | 103 | if (usb_read(adapter, CMD_GET_STATUS, 0, 0, pstatus, 1) != 1) { |
|---|
| 108 | 104 | dev_err(&adapter->dev, "failure reading status\n"); |
|---|
| 109 | | - ret = -EREMOTEIO; |
|---|
| 105 | + ret = -EIO; |
|---|
| 110 | 106 | goto out; |
|---|
| 111 | 107 | } |
|---|
| 112 | 108 | |
|---|
| 113 | 109 | dev_dbg(&adapter->dev, " status = %d\n", *pstatus); |
|---|
| 114 | 110 | if (*pstatus == STATUS_ADDRESS_NAK) { |
|---|
| 115 | | - ret = -EREMOTEIO; |
|---|
| 111 | + ret = -ENXIO; |
|---|
| 116 | 112 | goto out; |
|---|
| 117 | 113 | } |
|---|
| 118 | 114 | } |
|---|
| .. | .. |
|---|
| 230 | 226 | |
|---|
| 231 | 227 | /* allocate memory for our device state and initialize it */ |
|---|
| 232 | 228 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
|---|
| 233 | | - if (dev == NULL) { |
|---|
| 234 | | - dev_err(&interface->dev, "Out of memory\n"); |
|---|
| 229 | + if (!dev) |
|---|
| 235 | 230 | goto error; |
|---|
| 236 | | - } |
|---|
| 237 | 231 | |
|---|
| 238 | 232 | dev->usb_dev = usb_get_dev(interface_to_usbdev(interface)); |
|---|
| 239 | 233 | dev->interface = interface; |
|---|