ptp: ocp: Make ptp_ocp_unregister_ext() NULL-aware
It's a common practice to make resource release functions be NULL-aware. Make ptp_ocp_unregister_ext() NULL-aware. Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20251124084816.205035-3-andriy.shevchenko@linux.intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>pull/1354/merge
parent
622cc66ed7
commit
590f5d1fa6
|
|
@ -2225,6 +2225,9 @@ ptp_ocp_ts_enable(void *priv, u32 req, bool enable)
|
|||
static void
|
||||
ptp_ocp_unregister_ext(struct ptp_ocp_ext_src *ext)
|
||||
{
|
||||
if (!ext)
|
||||
return;
|
||||
|
||||
ext->info->enable(ext, ~0, false);
|
||||
pci_free_irq(ext->bp->pdev, ext->irq_vec, ext);
|
||||
kfree(ext);
|
||||
|
|
@ -4558,20 +4561,13 @@ ptp_ocp_detach(struct ptp_ocp *bp)
|
|||
ptp_ocp_detach_sysfs(bp);
|
||||
ptp_ocp_attr_group_del(bp);
|
||||
timer_delete_sync(&bp->watchdog);
|
||||
if (bp->ts0)
|
||||
ptp_ocp_unregister_ext(bp->ts0);
|
||||
if (bp->ts1)
|
||||
ptp_ocp_unregister_ext(bp->ts1);
|
||||
if (bp->ts2)
|
||||
ptp_ocp_unregister_ext(bp->ts2);
|
||||
if (bp->ts3)
|
||||
ptp_ocp_unregister_ext(bp->ts3);
|
||||
if (bp->ts4)
|
||||
ptp_ocp_unregister_ext(bp->ts4);
|
||||
if (bp->pps)
|
||||
ptp_ocp_unregister_ext(bp->pps);
|
||||
for (i = 0; i < 4; i++)
|
||||
if (bp->signal_out[i])
|
||||
ptp_ocp_unregister_ext(bp->signal_out[i]);
|
||||
for (i = 0; i < __PORT_COUNT; i++)
|
||||
if (bp->port[i].line != -1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue