mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-06 05:13:18 +00:00
s390/netiucv: 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/netiucv.c:1716:18: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict] 1716 | 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-3-fd048c9903b0@kernel.org Acked-by: Alexandra Winter <wintera@linux.ibm.com> Link: https://lore.kernel.org/r/20240506194454.1160315-4-hca@linux.ibm.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
parent
4ee55c9563
commit
968bfb566d
@ -1696,26 +1696,14 @@ static const struct attribute_group *netiucv_attr_groups[] = {
|
||||
static int netiucv_register_device(struct net_device *ndev)
|
||||
{
|
||||
struct netiucv_priv *priv = netdev_priv(ndev);
|
||||
struct device *dev = kzalloc(sizeof(struct device), GFP_KERNEL);
|
||||
struct device *dev;
|
||||
int ret;
|
||||
|
||||
IUCV_DBF_TEXT(trace, 3, __func__);
|
||||
|
||||
if (dev) {
|
||||
dev_set_name(dev, "net%s", ndev->name);
|
||||
dev->bus = &iucv_bus;
|
||||
dev->parent = iucv_root;
|
||||
dev->groups = netiucv_attr_groups;
|
||||
/*
|
||||
* The release function could be called after the
|
||||
* module has been unloaded. It's _only_ task is to
|
||||
* free the struct. Therefore, we specify kfree()
|
||||
* directly here. (Probably a little bit obfuscating
|
||||
* but legitime ...).
|
||||
*/
|
||||
dev->release = (void (*)(struct device *))kfree;
|
||||
dev->driver = &netiucv_driver;
|
||||
} else
|
||||
dev = iucv_alloc_device(netiucv_attr_groups, &netiucv_driver, NULL,
|
||||
"net%s", ndev->name);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = device_register(dev);
|
||||
|
Loading…
Reference in New Issue
Block a user