ibcore: Mark write-only variables

Some LinuxKPI lock macros pass need a flags field passed in. This is
written to but never read from so gcc complains.

Fix this by marking the flags variables as unused to quieten the
compiler.

Reviewed by:	brooks (earlier version), kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45303

(cherry picked from commit 19782e5bef3403a6ed65d46653f2e70f81dced37)
This commit is contained in:
Andrew Turner 2024-06-12 14:04:45 +01:00
parent 833ccd66da
commit 77d05874de
2 changed files with 10 additions and 10 deletions

View file

@ -465,7 +465,7 @@ static int _ib_cache_gid_table_find(struct ib_device *ib_dev,
struct ib_gid_table *table;
u8 p;
int local_index;
unsigned long flags;
unsigned long flags __writeonly;
for (p = 0; p < ib_dev->phys_port_cnt; p++) {
table = ports_table[p];
@ -514,7 +514,7 @@ int ib_find_cached_gid_by_port(struct ib_device *ib_dev,
unsigned long mask = GID_ATTR_FIND_MASK_GID |
GID_ATTR_FIND_MASK_GID_TYPE;
struct ib_gid_attr val = {.ndev = ndev, .gid_type = gid_type};
unsigned long flags;
unsigned long flags __writeonly;
if (!rdma_is_port_valid(ib_dev, port))
return -ENOENT;
@ -570,7 +570,7 @@ static int ib_cache_gid_find_by_filter(struct ib_device *ib_dev,
struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
struct ib_gid_table *table;
unsigned int i;
unsigned long flags;
unsigned long flags __writeonly;
bool found = false;
if (!ports_table)
@ -879,7 +879,7 @@ int ib_get_cached_gid(struct ib_device *device,
struct ib_gid_attr *gid_attr)
{
int res;
unsigned long flags;
unsigned long flags __writeonly;
struct ib_gid_table **ports_table = device->cache.gid_cache;
struct ib_gid_table *table = ports_table[port_num - rdma_start_port(device)];
@ -929,7 +929,7 @@ int ib_get_cached_pkey(struct ib_device *device,
u16 *pkey)
{
struct ib_pkey_cache *cache;
unsigned long flags;
unsigned long flags __writeonly;
int ret = 0;
if (!rdma_is_port_valid(device, port_num))
@ -956,7 +956,7 @@ int ib_find_cached_pkey(struct ib_device *device,
u16 *index)
{
struct ib_pkey_cache *cache;
unsigned long flags;
unsigned long flags __writeonly;
int i;
int ret = -ENOENT;
int partial_ix = -1;
@ -997,7 +997,7 @@ int ib_find_exact_cached_pkey(struct ib_device *device,
u16 *index)
{
struct ib_pkey_cache *cache;
unsigned long flags;
unsigned long flags __writeonly;
int i;
int ret = -ENOENT;
@ -1027,7 +1027,7 @@ int ib_get_cached_lmc(struct ib_device *device,
u8 port_num,
u8 *lmc)
{
unsigned long flags;
unsigned long flags __writeonly;
int ret = 0;
if (!rdma_is_port_valid(device, port_num))

View file

@ -4057,7 +4057,7 @@ static void cm_add_one(struct ib_device *ib_device)
struct ib_port_modify port_modify = {
.set_port_cap_mask = IB_PORT_CM_SUP
};
unsigned long flags;
unsigned long flags __writeonly;
int ret;
int count = 0;
u8 i;
@ -4150,7 +4150,7 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data)
struct ib_port_modify port_modify = {
.clr_port_cap_mask = IB_PORT_CM_SUP
};
unsigned long flags;
unsigned long flags __writeonly;
int i;
if (!cm_dev)