This particular BUG_ON condition was checking for attr set err in the COMMIT phase, which isn't expected (it's a driver bug if PREPARE phase is OK but COMMIT fails). But BUG_ON() is too strong for this case, so change to WARN(). BUG_ON() would be warranted if the system was corrupted beyond repair, but this is not the case here.
Unified · Split
| @@ -184,7 +184,8 @@ int switchdev_port_attr_set(struct net_device *dev, struct switchdev_attr *attr) · 183 unmodified lines | ||
| 184 | 184 | |
| 185 | 185 | attr->trans = SWITCHDEV_TRANS_COMMIT; |
| 186 | 186 | err = __switchdev_port_attr_set(dev, attr); |
| 187 | − BUG_ON(err); | |
| 187 | + WARN(err, "%s: Commit of attribute (id=%d) failed.\n", | |
| 188 | + dev->name, attr->id); | |
| 188 | 189 | |
| 189 | 190 | return err; |
| 190 | 191 | } |