[BUG] ptp: ocp: Warning when the ptp_ocp driver fails to probe

From: Zheyu Ma
Date: Sun Apr 10 2022 - 02:14:30 EST


Hello,

I found a bug in the ptp_ocp driver.
When the ptp_ocp driver fails to probe at the function
ptp_clock_register(), we will get the following splat:

[ 3.354719] ptp_ocp 0000:00:05.0: clock not enabled
[ 3.355127] ptp_ocp 0000:00:05.0: Could not register (null): err -19
[ 3.358800] ------------[ cut here ]------------
[ 3.359200] sysfs group 'gen1' not found for kobject 'ocp0'
[ 3.359671] WARNING: CPU: 6 PID: 256 at fs/sysfs/group.c:280
sysfs_remove_group+0x9f/0x220
[ 3.366602] RIP: 0010:sysfs_remove_group+0x9f/0x220
[ 3.375709] Call Trace:
[ 3.375920] <TASK>
[ 3.376119] ptp_ocp_detach+0x117/0xe60 [ptp_ocp]
[ 3.376568] ptp_ocp_probe+0xb1f/0x1830 [ptp_ocp]
[ 3.376967] ? rcu_read_lock_sched_held+0x2f/0x70
[ 3.377379] ? lockdep_hardirqs_on_prepare+0x347/0x620
[ 3.377810] ? _raw_spin_unlock_irqrestore+0x2d/0x60
[ 3.378277] ? lockdep_hardirqs_on+0x7b/0x100
[ 3.378646] ? _raw_spin_unlock_irqrestore+0x3d/0x60
[ 3.379063] ? ptp_ocp_i2c_notifier_call+0x1c0/0x1c0 [ptp_ocp]
[ 3.379558] pci_device_probe+0x40e/0x8d0

Regards,
Zheyu Ma