| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 2008 by Karsten Keil <kkeil@novell.com> |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 9 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 11 | | - * GNU General Public License for more details. |
|---|
| 12 | | - * |
|---|
| 13 | 4 | */ |
|---|
| 14 | 5 | |
|---|
| 15 | 6 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 231 | 222 | |
|---|
| 232 | 223 | err = get_free_devid(); |
|---|
| 233 | 224 | if (err < 0) |
|---|
| 234 | | - goto error1; |
|---|
| 225 | + return err; |
|---|
| 235 | 226 | dev->id = err; |
|---|
| 236 | 227 | |
|---|
| 237 | 228 | device_initialize(&dev->dev); |
|---|
| .. | .. |
|---|
| 242 | 233 | if (debug & DEBUG_CORE) |
|---|
| 243 | 234 | printk(KERN_DEBUG "mISDN_register %s %d\n", |
|---|
| 244 | 235 | dev_name(&dev->dev), dev->id); |
|---|
| 236 | + dev->dev.class = &mISDN_class; |
|---|
| 237 | + |
|---|
| 245 | 238 | err = create_stack(dev); |
|---|
| 246 | 239 | if (err) |
|---|
| 247 | 240 | goto error1; |
|---|
| 248 | 241 | |
|---|
| 249 | | - dev->dev.class = &mISDN_class; |
|---|
| 250 | 242 | dev->dev.platform_data = dev; |
|---|
| 251 | 243 | dev->dev.parent = parent; |
|---|
| 252 | 244 | dev_set_drvdata(&dev->dev, dev); |
|---|
| .. | .. |
|---|
| 258 | 250 | |
|---|
| 259 | 251 | error3: |
|---|
| 260 | 252 | delete_stack(dev); |
|---|
| 261 | | - return err; |
|---|
| 262 | 253 | error1: |
|---|
| 254 | + put_device(&dev->dev); |
|---|
| 263 | 255 | return err; |
|---|
| 264 | 256 | |
|---|
| 265 | 257 | } |
|---|