linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Zhang, Tianfei" <tianfei.zhang@intel.com>
Cc: "richardcochran@gmail.com" <richardcochran@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-fpga@vger.kernel.org" <linux-fpga@vger.kernel.org>,
	"ilpo.jarvinen@linux.intel.com" <ilpo.jarvinen@linux.intel.com>,
	"Gomes, Vinicius" <vinicius.gomes@intel.com>,
	"pierre-louis.bossart@linux.intel.com" 
	<pierre-louis.bossart@linux.intel.com>,
	"Pagani, Marco" <marpagan@redhat.com>,
	"Weight, Russell H" <russell.h.weight@intel.com>,
	"matthew.gerlach@linux.intel.com"
	<matthew.gerlach@linux.intel.com>,
	"nico@fluxnic.net" <nico@fluxnic.net>,
	"Khadatare,
	RaghavendraX Anand"  <raghavendrax.anand.khadatare@intel.com>
Subject: Re: [PATCH v2] ptp: add ToD device driver for Intel FPGA cards
Date: Wed, 22 Mar 2023 17:03:41 +0200	[thread overview]
Message-ID: <ZBsYzZgonva5f3fB@smile.fi.intel.com> (raw)
In-Reply-To: <BN9PR11MB54839A3B9CBE7BB679FBFE4CE3869@BN9PR11MB5483.namprd11.prod.outlook.com>

On Wed, Mar 22, 2023 at 02:59:21PM +0000, Zhang, Tianfei wrote:
> > -----Original Message-----
> > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Sent: Wednesday, March 22, 2023 10:49 PM
> > To: Zhang, Tianfei <tianfei.zhang@intel.com>
> > Cc: richardcochran@gmail.com; netdev@vger.kernel.org; linux-
> > fpga@vger.kernel.org; ilpo.jarvinen@linux.intel.com; Gomes, Vinicius
> > <vinicius.gomes@intel.com>; pierre-louis.bossart@linux.intel.com; Pagani, Marco
> > <marpagan@redhat.com>; Weight, Russell H <russell.h.weight@intel.com>;
> > matthew.gerlach@linux.intel.com; nico@fluxnic.net; Khadatare, RaghavendraX
> > Anand <raghavendrax.anand.khadatare@intel.com>
> > Subject: Re: [PATCH v2] ptp: add ToD device driver for Intel FPGA cards
> > 
> > On Wed, Mar 22, 2023 at 10:35:47AM -0400, Tianfei Zhang wrote:
> > > Adding a DFL (Device Feature List) device driver of ToD device for
> > > Intel FPGA cards.
> > >
> > > The Intel FPGA Time of Day(ToD) IP within the FPGA DFL bus is exposed
> > > as PTP Hardware clock(PHC) device to the Linux PTP stack to
> > > synchronize the system clock to its ToD information using phc2sys
> > > utility of the Linux PTP stack. The DFL is a hardware List within
> > > FPGA, which defines a linked list of feature headers within the device
> > > MMIO space to provide an extensible way of adding subdevice features.

...

> > > +	dt->ptp_clock = ptp_clock_register(&dt->ptp_clock_ops, dev);
> > > +	if (IS_ERR_OR_NULL(dt->ptp_clock))
> > > +		return dev_err_probe(dt->dev, PTR_ERR_OR_ZERO(dt->ptp_clock),
> > > +				     "Unable to register PTP clock\n");
> > > +
> > > +	return 0;
> > 
> > Can be as simple as:
> > 
> > 	ret = PTR_ERR_OR_ZERO(dt->ptp_clock);
> > 	return dev_err_probe(dt->dev, ret, "Unable to register PTP clock\n");
> 
>             This should be :
>            ret = PTR_ERR_OR_ZERO(dt->ptp_clock);
>            if (ret)
>                     return dev_err_probe(dt->dev, ret, "Unable to register PTP clock\n");
>            return 0;

It depends how you treat the NULL from ptp_clock_register() and why driver will
be still bound to the device even if it doesn't provide PTP facility.

Either way you need to thing about this error handling and come up with
something that you can explain why it's done this way and not another.

>         But this will be introduced one more local variable "ret" in this function.

Is it a problem?

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-03-22 15:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 14:35 [PATCH v2] ptp: add ToD device driver for Intel FPGA cards Tianfei Zhang
2023-03-22 14:48 ` Andy Shevchenko
2023-03-22 14:59   ` Zhang, Tianfei
2023-03-22 15:03     ` Andy Shevchenko [this message]
2023-03-22 15:36       ` Zhang, Tianfei
2023-03-22 15:07 ` Ilpo Järvinen
2023-03-22 15:17   ` Zhang, Tianfei
2023-03-23  3:33 ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBsYzZgonva5f3fB@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=marpagan@redhat.com \
    --cc=matthew.gerlach@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nico@fluxnic.net \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=raghavendrax.anand.khadatare@intel.com \
    --cc=richardcochran@gmail.com \
    --cc=russell.h.weight@intel.com \
    --cc=tianfei.zhang@intel.com \
    --cc=vinicius.gomes@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).