diff options
author | Pascal Ernster <git@hardfalcon.net> | 2023-01-05 06:56:38 +0100 |
---|---|---|
committer | Sander Vanheule <sander@svanheule.net> | 2023-01-05 23:09:23 +0100 |
commit | 720b2431716b16a93848e10788ae6d36856a34b2 (patch) | |
tree | df61cb6d79515b0e9e44d1b796076b496d8d3653 /target/linux | |
parent | a188536ef6507e30cba218182e673349ea48cbe7 (diff) | |
download | upstream-720b2431716b16a93848e10788ae6d36856a34b2.tar.gz upstream-720b2431716b16a93848e10788ae6d36856a34b2.tar.bz2 upstream-720b2431716b16a93848e10788ae6d36856a34b2.zip |
realtek: 5.15: Improve error handling in rtl838x_pie_rule_write()
In target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c,
make rtl838x_pie_rule_write() return non-zero value case of error.
Signed-off-by: Pascal Ernster <git@hardfalcon.net>
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c index 8a162df9a4..504b29822a 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c @@ -1335,7 +1335,7 @@ static int rtl838x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str /* Access IACL table (1) via register 0 */ struct table_reg *q = rtl_table_get(RTL8380_TBL_0, 1); u32 r[18]; - int err = 0; + int err; int block = idx / PIE_BLOCK_SIZE; u32 t_select = sw_r32(RTL838X_ACL_BLK_TMPLTE_CTRL(block)); @@ -1344,17 +1344,21 @@ static int rtl838x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str for (int i = 0; i < 18; i++) r[i] = 0; - if (!pr->valid) - goto err_out; + if (!pr->valid) { + err = -EINVAL; + pr_err("Rule invalid\n"); + goto errout; + } rtl838x_write_pie_fixed_fields(r, pr); pr_debug("%s: template %d\n", __func__, (t_select >> (pr->tid * 3)) & 0x7); rtl838x_write_pie_templated(r, pr, fixed_templates[(t_select >> (pr->tid * 3)) & 0x7]); - if (rtl838x_write_pie_action(r, pr)) { + err = rtl838x_write_pie_action(r, pr); + if (err) { pr_err("Rule actions too complex\n"); - goto err_out; + goto errout; } /* rtl838x_pie_rule_dump_raw(r); */ @@ -1362,7 +1366,7 @@ static int rtl838x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str for (int i = 0; i < 18; i++) sw_w32(r[i], rtl_table_data(q, i)); -err_out: +errout: rtl_table_write(q, idx); rtl_table_release(q); |