lkml.org 
[lkml]   [2020]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Re: [PATCH V4 net-bugfixs] net/ethernet: Update ret when ptp_clock is ERROR
On Thu, Nov 12, 2020 at 09:25:12AM +0100, Arnd Bergmann wrote:
> This is not really getting any better. If Richard is worried about
> Kconfig getting changed here, I would suggest handling the
> case of PTP being disabled by returning an error early on in the
> function, like
>
> struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs,
> struct device_node *node)
> {
> struct am65_cpts *cpts;
> int ret, i;
>
> if (!IS_ENABLED(CONFIG_PTP_1588_CLOCK))
> return -ENODEV;

No, please, no. That only adds confusion. The NULL return value
already signals that the compile time support was missing. That was
the entire point of this...

* ptp_clock_register() - register a PTP hardware clock driver
*
* @info: Structure describing the new clock.
* @parent: Pointer to the parent device of the new clock.
*
* Returns a valid pointer on success or PTR_ERR on failure. If PHC
* support is missing at the configuration level, this function
* returns NULL, and drivers are expected to gracefully handle that
* case separately.

Thanks,
Richard

\
 
 \ /
  Last update: 2020-11-12 19:20    [W:0.093 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site