Skip to content

Commit 4b5ed2b

Browse files
Jiri Pirkokuba-moo
authored andcommitted
devlink: save devlink_port_ops into a variable in devlink_port_function_validate()
Now when the original ops variable is removed, introduce it again but this time for devlink_port_ops. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 216ba9f commit 4b5ed2b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

net/devlink/leftover.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,16 +1185,16 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port,
11851185
struct nlattr **tb,
11861186
struct netlink_ext_ack *extack)
11871187
{
1188+
const struct devlink_port_ops *ops = devlink_port->ops;
11881189
struct nlattr *attr;
11891190

11901191
if (tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] &&
1191-
!devlink_port->ops->port_fn_hw_addr_set) {
1192+
!ops->port_fn_hw_addr_set) {
11921193
NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR],
11931194
"Port doesn't support function attributes");
11941195
return -EOPNOTSUPP;
11951196
}
1196-
if (tb[DEVLINK_PORT_FN_ATTR_STATE] &&
1197-
!devlink_port->ops->port_fn_state_set) {
1197+
if (tb[DEVLINK_PORT_FN_ATTR_STATE] && !ops->port_fn_state_set) {
11981198
NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR],
11991199
"Function does not support state setting");
12001200
return -EOPNOTSUPP;
@@ -1205,13 +1205,13 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port,
12051205

12061206
caps = nla_get_bitfield32(attr);
12071207
if (caps.selector & DEVLINK_PORT_FN_CAP_ROCE &&
1208-
!devlink_port->ops->port_fn_roce_set) {
1208+
!ops->port_fn_roce_set) {
12091209
NL_SET_ERR_MSG_ATTR(extack, attr,
12101210
"Port doesn't support RoCE function attribute");
12111211
return -EOPNOTSUPP;
12121212
}
12131213
if (caps.selector & DEVLINK_PORT_FN_CAP_MIGRATABLE) {
1214-
if (!devlink_port->ops->port_fn_migratable_set) {
1214+
if (!ops->port_fn_migratable_set) {
12151215
NL_SET_ERR_MSG_ATTR(extack, attr,
12161216
"Port doesn't support migratable function attribute");
12171217
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)