Commit 5d50f400 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Doug Ledford

RDMA/usnic: Fix remove address space warning

Sparse tool complains with the following error:
drivers/infiniband/hw/usnic/usnic_ib_main.c:445:16: warning: cast removes
	address space of expression

Fix it by doing casting on correct field and convert function helper which
sets ifaddr to be void, because there are no users who are interested in
returned value.

Fixes: c7845bca ("IB/usnic: Add UDP support in u*verbs.c, u*main.c and u*util.h")
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 31f97bad
...@@ -110,20 +110,12 @@ void usnic_fwd_set_mac(struct usnic_fwd_dev *ufdev, char mac[ETH_ALEN]) ...@@ -110,20 +110,12 @@ void usnic_fwd_set_mac(struct usnic_fwd_dev *ufdev, char mac[ETH_ALEN])
spin_unlock(&ufdev->lock); spin_unlock(&ufdev->lock);
} }
int usnic_fwd_add_ipaddr(struct usnic_fwd_dev *ufdev, __be32 inaddr) void usnic_fwd_add_ipaddr(struct usnic_fwd_dev *ufdev, __be32 inaddr)
{ {
int status;
spin_lock(&ufdev->lock); spin_lock(&ufdev->lock);
if (ufdev->inaddr == 0) { if (!ufdev->inaddr)
ufdev->inaddr = inaddr; ufdev->inaddr = inaddr;
status = 0;
} else {
status = -EFAULT;
}
spin_unlock(&ufdev->lock); spin_unlock(&ufdev->lock);
return status;
} }
void usnic_fwd_del_ipaddr(struct usnic_fwd_dev *ufdev) void usnic_fwd_del_ipaddr(struct usnic_fwd_dev *ufdev)
......
...@@ -75,7 +75,7 @@ struct usnic_fwd_dev *usnic_fwd_dev_alloc(struct pci_dev *pdev); ...@@ -75,7 +75,7 @@ struct usnic_fwd_dev *usnic_fwd_dev_alloc(struct pci_dev *pdev);
void usnic_fwd_dev_free(struct usnic_fwd_dev *ufdev); void usnic_fwd_dev_free(struct usnic_fwd_dev *ufdev);
void usnic_fwd_set_mac(struct usnic_fwd_dev *ufdev, char mac[ETH_ALEN]); void usnic_fwd_set_mac(struct usnic_fwd_dev *ufdev, char mac[ETH_ALEN]);
int usnic_fwd_add_ipaddr(struct usnic_fwd_dev *ufdev, __be32 inaddr); void usnic_fwd_add_ipaddr(struct usnic_fwd_dev *ufdev, __be32 inaddr);
void usnic_fwd_del_ipaddr(struct usnic_fwd_dev *ufdev); void usnic_fwd_del_ipaddr(struct usnic_fwd_dev *ufdev);
void usnic_fwd_carrier_up(struct usnic_fwd_dev *ufdev); void usnic_fwd_carrier_up(struct usnic_fwd_dev *ufdev);
void usnic_fwd_carrier_down(struct usnic_fwd_dev *ufdev); void usnic_fwd_carrier_down(struct usnic_fwd_dev *ufdev);
......
...@@ -351,7 +351,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev) ...@@ -351,7 +351,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
{ {
struct usnic_ib_dev *us_ibdev; struct usnic_ib_dev *us_ibdev;
union ib_gid gid; union ib_gid gid;
struct in_ifaddr *in; struct in_device *ind;
struct net_device *netdev; struct net_device *netdev;
usnic_dbg("\n"); usnic_dbg("\n");
...@@ -441,9 +441,11 @@ static void *usnic_ib_device_add(struct pci_dev *dev) ...@@ -441,9 +441,11 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
if (netif_carrier_ok(us_ibdev->netdev)) if (netif_carrier_ok(us_ibdev->netdev))
usnic_fwd_carrier_up(us_ibdev->ufdev); usnic_fwd_carrier_up(us_ibdev->ufdev);
in = ((struct in_device *)(netdev->ip_ptr))->ifa_list; ind = in_dev_get(netdev);
if (in != NULL) if (ind->ifa_list)
usnic_fwd_add_ipaddr(us_ibdev->ufdev, in->ifa_address); usnic_fwd_add_ipaddr(us_ibdev->ufdev,
ind->ifa_list->ifa_address);
in_dev_put(ind);
usnic_mac_ip_to_gid(us_ibdev->netdev->perm_addr, usnic_mac_ip_to_gid(us_ibdev->netdev->perm_addr,
us_ibdev->ufdev->inaddr, &gid.raw[0]); us_ibdev->ufdev->inaddr, &gid.raw[0]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment