net: dsa: strip sysfs "tagging" string of trailing newline
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 15 Nov 2022 01:18:45 +0000 (03:18 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 18 Nov 2022 05:16:42 +0000 (21:16 -0800)
commite8666130b995a6a1a99c319d33fae2046213c39b
tree3787020961d1255b11386d9fe32a9ef232868417
parent94793a56b3df0ff2b8c5680f926c19effd8b9ccc
net: dsa: strip sysfs "tagging" string of trailing newline

Currently, dsa_find_tagger_by_name() uses sysfs_streq() which works both
with strings that contain \n at the end (echo ocelot > .../dsa/tagging)
and with strings that don't (printf ocelot > .../dsa/tagging).

There will be a problem once we'll want to construct the modalias string
based on which we auto-load the protocol kernel module. If the sysfs
buffer ends in a newline, we need to strip it first. This is a
preparatory patch specifically for that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/dsa/dsa.c
net/dsa/dsa_priv.h
net/dsa/master.c