[bug report] octeontx2-af: Add PTP PPS Errata workaround on CN10K silicon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Naveen Mamindlapalli,

The patch 2ef4e45d99b1: "octeontx2-af: Add PTP PPS Errata workaround
on CN10K silicon" from Sep 10, 2022, leads to the following Smatch
static checker warning:

	drivers/net/ethernet/marvell/octeontx2/af/ptp.c:455 ptp_remove()
	warn: variable dereferenced before IS_ERR check 'ptp' (see line 452)

drivers/net/ethernet/marvell/octeontx2/af/ptp.c
    447 static void ptp_remove(struct pci_dev *pdev)
    448 {
    449         struct ptp *ptp = pci_get_drvdata(pdev);
    450         u64 clock_cfg;
    451 
    452         if (cn10k_ptp_errata(ptp) && hrtimer_active(&ptp->hrtimer))
                                     ^^^                    ^^^^

    453                 hrtimer_cancel(&ptp->hrtimer);
                                       ^^^^
Dereferences.

    454 
--> 455         if (IS_ERR_OR_NULL(ptp))
                                   ^^^
Checked too late.  Hopefully this check can be removed.

    456                 return;
    457 
    458         /* Disable PTP clock */
    459         clock_cfg = readq(ptp->reg_base + PTP_CLOCK_CFG);
    460         clock_cfg &= ~PTP_CLOCK_CFG_PTP_EN;
    461         writeq(clock_cfg, ptp->reg_base + PTP_CLOCK_CFG);
    462 }

regards,
dan carpenter



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux