]> git.baikalelectronics.ru Git - kernel.git/commit
ptp: ocp: change sysfs attr group handling
authorJonathan Lemon <jonathan.lemon@gmail.com>
Tue, 17 May 2022 21:46:00 +0000 (14:46 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 19 May 2022 04:44:37 +0000 (21:44 -0700)
commitc2239294188fdbc3c58784a08d90edacd177bf9a
tree5a13c0f1f20a112efe36a73d0295e53974027f6c
parent090f9dd092c6c2e9e4b9d0472b8d8628e4b851cb
ptp: ocp: change sysfs attr group handling

In the detach path, the driver calls sysfs_remove_group() for the
groups it believes has been registered.  However, if the group was
never previously registered, then this causes a splat.

Instead, compute the groups that should be registered in advance,
and then call sysfs_create_groups(), which registers them all at once.

Update the error handling appropriately.

Fixes: c205d53c4923 ("ptp: ocp: Add firmware capability bits for feature gating")
Reported-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Link: https://lore.kernel.org/r/20220517214600.10606-1-jonathan.lemon@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/ptp/ptp_ocp.c