aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ftdi_sio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/ftdi_sio.c')
-rw-r--r--drivers/usb/serial/ftdi_sio.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index c6115aa1b445..1f7b72553f37 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1101,25 +1101,29 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att
1101static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, store_latency_timer); 1101static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, store_latency_timer);
1102static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); 1102static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char);
1103 1103
1104static void create_sysfs_attrs(struct usb_serial *serial) 1104static int create_sysfs_attrs(struct usb_serial *serial)
1105{ 1105{
1106 struct ftdi_private *priv; 1106 struct ftdi_private *priv;
1107 struct usb_device *udev; 1107 struct usb_device *udev;
1108 int retval = 0;
1108 1109
1109 dbg("%s",__FUNCTION__); 1110 dbg("%s",__FUNCTION__);
1110 1111
1111 priv = usb_get_serial_port_data(serial->port[0]); 1112 priv = usb_get_serial_port_data(serial->port[0]);
1112 udev = serial->dev; 1113 udev = serial->dev;
1113 1114
1114 /* XXX I've no idea if the original SIO supports the event_char 1115 /* XXX I've no idea if the original SIO supports the event_char
1115 * sysfs parameter, so I'm playing it safe. */ 1116 * sysfs parameter, so I'm playing it safe. */
1116 if (priv->chip_type != SIO) { 1117 if (priv->chip_type != SIO) {
1117 dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]); 1118 dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]);
1118 device_create_file(&udev->dev, &dev_attr_event_char); 1119 retval = device_create_file(&udev->dev, &dev_attr_event_char);
1119 if (priv->chip_type == FT232BM || priv->chip_type == FT2232C) { 1120 if ((!retval) &&
1120 device_create_file(&udev->dev, &dev_attr_latency_timer); 1121 (priv->chip_type == FT232BM || priv->chip_type == FT2232C)) {
1122 retval = device_create_file(&udev->dev,
1123 &dev_attr_latency_timer);
1121 } 1124 }
1122 } 1125 }
1126 return retval;
1123} 1127}
1124 1128
1125static void remove_sysfs_attrs(struct usb_serial *serial) 1129static void remove_sysfs_attrs(struct usb_serial *serial)
@@ -1162,7 +1166,8 @@ static int ftdi_sio_attach (struct usb_serial *serial)
1162 struct usb_serial_port *port = serial->port[0]; 1166 struct usb_serial_port *port = serial->port[0];
1163 struct ftdi_private *priv; 1167 struct ftdi_private *priv;
1164 struct ftdi_sio_quirk *quirk; 1168 struct ftdi_sio_quirk *quirk;
1165 1169 int retval;
1170
1166 dbg("%s",__FUNCTION__); 1171 dbg("%s",__FUNCTION__);
1167 1172
1168 priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL); 1173 priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL);
@@ -1203,15 +1208,18 @@ static int ftdi_sio_attach (struct usb_serial *serial)
1203 usb_set_serial_port_data(serial->port[0], priv); 1208 usb_set_serial_port_data(serial->port[0], priv);
1204 1209
1205 ftdi_determine_type (serial->port[0]); 1210 ftdi_determine_type (serial->port[0]);
1206 create_sysfs_attrs(serial); 1211 retval = create_sysfs_attrs(serial);
1212 if (retval)
1213 dev_err(&serial->dev->dev, "Error creating sysfs files, "
1214 "continuing\n");
1207 1215
1208 /* Check for device requiring special set up. */ 1216 /* Check for device requiring special set up. */
1209 quirk = (struct ftdi_sio_quirk *)usb_get_serial_data(serial); 1217 quirk = (struct ftdi_sio_quirk *)usb_get_serial_data(serial);
1210 if (quirk && quirk->setup) { 1218 if (quirk && quirk->setup) {
1211 quirk->setup(serial); 1219 quirk->setup(serial);
1212 } 1220 }
1213 1221
1214 return (0); 1222 return 0;
1215} /* ftdi_sio_attach */ 1223} /* ftdi_sio_attach */
1216 1224
1217 1225