diff mbox series

[net-next] ibmveth: fix kobj_to_dev.cocci warnings

Message ID 20210519022849.12752-1-yuehaibing@huawei.com
State New
Headers show
Series [net-next] ibmveth: fix kobj_to_dev.cocci warnings | expand

Commit Message

Yue Haibing May 19, 2021, 2:28 a.m. UTC
Use kobj_to_dev() instead of container_of()

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

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/ethernet/ibm/ibmveth.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Lijun Pan May 19, 2021, 5:20 a.m. UTC | #1
> On May 18, 2021, at 9:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
> 
> 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>


> drivers/net/ethernet/ibm/ibmveth.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index 7fea9ae60f13..bc67a7ee872b 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -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;
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 7fea9ae60f13..bc67a7ee872b 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -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;