Skip to content

Commit 3bbde49

Browse files
hcahcaAlexander Gordeev
authored andcommitted
s390/smsgiucv_app: Make use of iucv_alloc_device()
Make use of iucv_alloc_device() to get rid of quite some code. In addition this also removes a cast to an incompatible function (clang W=1): drivers/s390/net/smsgiucv_app.c:176:26: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict] 176 | smsg_app_dev->release = (void (*)(struct device *)) kfree; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reported-by: Nathan Chancellor <nathan@kernel.org> Closes: https://lore.kernel.org/r/20240417-s390-drivers-fix-cast-function-type-v1-2-fd048c9903b0@kernel.org Acked-by: Alexandra Winter <wintera@linux.ibm.com> Link: https://lore.kernel.org/r/20240506194454.1160315-5-hca@linux.ibm.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
1 parent 968bfb5 commit 3bbde49

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

drivers/s390/net/smsgiucv_app.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,25 +156,14 @@ static int __init smsgiucv_app_init(void)
156156
if (!MACHINE_IS_VM)
157157
return -ENODEV;
158158

159-
smsg_app_dev = kzalloc(sizeof(*smsg_app_dev), GFP_KERNEL);
160-
if (!smsg_app_dev)
161-
return -ENOMEM;
162-
163159
smsgiucv_drv = driver_find(SMSGIUCV_DRV_NAME, &iucv_bus);
164-
if (!smsgiucv_drv) {
165-
kfree(smsg_app_dev);
160+
if (!smsgiucv_drv)
166161
return -ENODEV;
167-
}
168162

169-
rc = dev_set_name(smsg_app_dev, KMSG_COMPONENT);
170-
if (rc) {
171-
kfree(smsg_app_dev);
172-
goto fail;
173-
}
174-
smsg_app_dev->bus = &iucv_bus;
175-
smsg_app_dev->parent = iucv_root;
176-
smsg_app_dev->release = (void (*)(struct device *)) kfree;
177-
smsg_app_dev->driver = smsgiucv_drv;
163+
smsg_app_dev = iucv_alloc_device(NULL, smsgiucv_drv, NULL, KMSG_COMPONENT);
164+
if (!smsg_app_dev)
165+
return -ENOMEM;
166+
178167
rc = device_register(smsg_app_dev);
179168
if (rc) {
180169
put_device(smsg_app_dev);

0 commit comments

Comments
 (0)