ibmveth: fix kobj_to_dev.cocci warnings
authorYueHaibing <yuehaibing@huawei.com>
Wed, 19 May 2021 02:28:49 +0000 (10:28 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 May 2021 19:01:02 +0000 (12:01 -0700)
Use kobj_to_dev() instead of container_of()

Generated by: scripts/coccinelle/api/kobj_to_dev.cocci

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Lijun Pan <lijunp213@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmveth.c

index 7fea9ae..bc67a7e 100644 (file)
@@ -1799,8 +1799,7 @@ static ssize_t veth_pool_store(struct kobject *kobj, struct attribute *attr,
        struct ibmveth_buff_pool *pool = container_of(kobj,
                                                      struct ibmveth_buff_pool,
                                                      kobj);
-       struct net_device *netdev = dev_get_drvdata(
-           container_of(kobj->parent, struct device, kobj));
+       struct net_device *netdev = dev_get_drvdata(kobj_to_dev(kobj->parent));
        struct ibmveth_adapter *adapter = netdev_priv(netdev);
        long value = simple_strtol(buf, NULL, 10);
        long rc;