ptp_ocp_probe() takes a reference on the dpll device with dpll_device_get(), but jumps to the out label without dropping it when dpll_device_register() fails, so the reference leaks. Put it before returning. Fixes: 09eeb3aecc6c ("ptp_ocp: implement DPLL ops") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang --- drivers/ptp/ptp_ocp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index beacc2ffb166..dacb941da8e9 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -5106,8 +5106,10 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) } err = dpll_device_register(bp->dpll, DPLL_TYPE_PPS, &dpll_ops, bp); - if (err) + if (err) { + dpll_device_put(bp->dpll, &bp->tracker); goto out; + } for (i = 0; i < OCP_SMA_NUM; i++) { bp->sma[i].dpll_pin = dpll_pin_get(clkid, i, THIS_MODULE, -- 2.34.1