lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5483E675D4FA5B37B2A86F76E3BE9@BN9PR11MB5483.namprd11.prod.outlook.com>
Date:   Tue, 14 Mar 2023 07:16:28 +0000
From:   "Zhang, Tianfei" <tianfei.zhang@...el.com>
To:     Richard Cochran <richardcochran@...il.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-fpga@...r.kernel.org" <linux-fpga@...r.kernel.org>,
        "ilpo.jarvinen@...ux.intel.com" <ilpo.jarvinen@...ux.intel.com>,
        "andriy.shevchenko@...ux.intel.com" 
        <andriy.shevchenko@...ux.intel.com>,
        "Weight, Russell H" <russell.h.weight@...el.com>,
        "matthew.gerlach@...ux.intel.com" <matthew.gerlach@...ux.intel.com>,
        "pierre-louis.bossart@...ux.intel.com" 
        <pierre-louis.bossart@...ux.intel.com>,
        "Gomes, Vinicius" <vinicius.gomes@...el.com>,
        "Khadatare, RaghavendraX Anand" 
        <raghavendrax.anand.khadatare@...el.com>
Subject: RE: [PATCH v1] ptp: add ToD device driver for Intel FPGA cards



> -----Original Message-----
> From: Richard Cochran <richardcochran@...il.com>
> Sent: Tuesday, March 14, 2023 2:50 AM
> To: Zhang, Tianfei <tianfei.zhang@...el.com>
> Cc: netdev@...r.kernel.org; linux-fpga@...r.kernel.org;
> ilpo.jarvinen@...ux.intel.com; andriy.shevchenko@...ux.intel.com; Weight, Russell H
> <russell.h.weight@...el.com>; matthew.gerlach@...ux.intel.com; pierre-
> louis.bossart@...ux.intel.com; Gomes, Vinicius <vinicius.gomes@...el.com>;
> Khadatare, RaghavendraX Anand <raghavendrax.anand.khadatare@...el.com>
> Subject: Re: [PATCH v1] ptp: add ToD device driver for Intel FPGA cards
> 
> On Sun, Mar 12, 2023 at 11:02:39PM -0400, Tianfei Zhang wrote:
> 
> 
> > +static int dfl_tod_probe(struct dfl_device *ddev) {
> > +	struct device *dev = &ddev->dev;
> > +	struct dfl_tod *dt;
> > +
> > +	dt = devm_kzalloc(dev, sizeof(*dt), GFP_KERNEL);
> > +	if (!dt)
> > +		return -ENOMEM;
> > +
> > +	dt->tod_ctrl = devm_ioremap_resource(dev, &ddev->mmio_res);
> > +	if (IS_ERR(dt->tod_ctrl))
> > +		return PTR_ERR(dt->tod_ctrl);
> > +
> > +	dt->dev = dev;
> > +	spin_lock_init(&dt->tod_lock);
> > +	dev_set_drvdata(dev, dt);
> > +
> > +	dt->ptp_clock_ops = dfl_tod_clock_ops;
> > +
> > +	dt->ptp_clock = ptp_clock_register(&dt->ptp_clock_ops, dev);
> > +	if (IS_ERR(dt->ptp_clock))
> > +		return dev_err_probe(dt->dev, PTR_ERR(dt->ptp_clock),
> > +				     "Unable to register PTP clock\n");
> 
> Need to handle NULL as well...

It looks like that it doesn't need check NULL for ptp_clock_register(), it handle the NULL case internally and return ERR_PTR(-ENOMEM).

struct ptp_clock *ptp_clock_register()
{
             err = -ENOMEM;
              ptp = kzalloc(sizeof(struct ptp_clock), GFP_KERNEL);
	if (ptp == NULL)
		goto no_memory;

              ...
           
            return ptp;

no_memory:
	return ERR_PTR(err);
}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ