[PATCH v6] watchdog: Add DA9063 PMIC watchdog driver.

Guenter Roeck linux at roeck-us.net
Wed Sep 24 06:30:55 PDT 2014


On 09/24/2014 02:10 AM, Markus Pargmann wrote:
> Hi,
>
> sorry for the late reply, I was on vacation.
>

No problem. Hope you had fun :-)

>>> +
>>> +static int da9063_wdt_probe(struct platform_device *pdev)
>>> +{
>>> +	int ret;
>>> +	struct da9063 *da9063;
>>> +	struct da9063_watchdog *wdt;
>>> +
>>> +	if (!pdev->dev.parent)
>>> +		return -EINVAL;
>>> +
>>> +	da9063 = dev_get_drvdata(pdev->dev.parent);
>>> +	if (!da9063)
>>> +		return -EINVAL;
>>> +
>>
>> This is not really an invalid argument. -ENODEV seems to be more appropriate,
>> given the context (presumably it means that there is no parent mfd device).
>
> Yes, but ENODEV will not result in a probe error message because the
> driver core assumes that the driver is not for this device. I would like
> to have a probe error message so that developers immediately see that
> something went wrong. This driver without a parent is a invalid setup,
> so I chose EINVAL.
> I prefer returning -EINVAL but as an alternative I could add an error
> message here and return ENODEV.
>

Good point. Given the context, one can argue that having no driver data _is_
an invalid argument (to the function), so I am fine with that.

Guenter




More information about the linux-arm-kernel mailing list