hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/dio/dio.c
....@@ -89,8 +89,8 @@
8989 #undef DIONAME
9090 #undef DIOFBNAME
9191
92
-static const char *unknowndioname
93
- = "unknown DIO board -- please email <linux-m68k@lists.linux-m68k.org>!";
92
+static const char unknowndioname[]
93
+ = "unknown DIO board, please email linux-m68k@lists.linux-m68k.org";
9494
9595 static const char *dio_getname(int id)
9696 {
....@@ -109,6 +109,12 @@
109109 #define dio_getname(_id) (dio_no_name)
110110
111111 #endif /* CONFIG_DIO_CONSTANTS */
112
+
113
+static void dio_dev_release(struct device *dev)
114
+{
115
+ struct dio_dev *ddev = container_of(dev, typeof(struct dio_dev), dev);
116
+ kfree(ddev);
117
+}
112118
113119 int __init dio_find(int deviceid)
114120 {
....@@ -135,7 +141,8 @@
135141 else
136142 va = ioremap(pa, PAGE_SIZE);
137143
138
- if (probe_kernel_read(&i, (unsigned char *)va + DIO_IDOFF, 1)) {
144
+ if (copy_from_kernel_nofault(&i,
145
+ (unsigned char *)va + DIO_IDOFF, 1)) {
139146 if (scode >= DIOII_SCBASE)
140147 iounmap(va);
141148 continue; /* no board present at that select code */
....@@ -208,7 +215,8 @@
208215 else
209216 va = ioremap(pa, PAGE_SIZE);
210217
211
- if (probe_kernel_read(&i, (unsigned char *)va + DIO_IDOFF, 1)) {
218
+ if (copy_from_kernel_nofault(&i,
219
+ (unsigned char *)va + DIO_IDOFF, 1)) {
212220 if (scode >= DIOII_SCBASE)
213221 iounmap(va);
214222 continue; /* no board present at that select code */
....@@ -222,6 +230,7 @@
222230 dev->bus = &dio_bus;
223231 dev->dev.parent = &dio_bus.dev;
224232 dev->dev.bus = &dio_bus_type;
233
+ dev->dev.release = dio_dev_release;
225234 dev->scode = scode;
226235 dev->resource.start = pa;
227236 dev->resource.end = pa + DIO_SIZE(scode, va);
....@@ -249,6 +258,7 @@
249258 if (error) {
250259 pr_err("DIO: Error registering device %s\n",
251260 dev->name);
261
+ put_device(&dev->dev);
252262 continue;
253263 }
254264 error = dio_create_sysfs_dev_files(dev);