Thread (35 messages) 35 messages, 5 authors, 2020-07-28

Re: [PATCH v6 06/13] pwm: add support for sl28cpld PWM controller

From: Lee Jones <hidden>
Date: 2020-07-28 10:51:28
Also in: linux-devicetree, linux-gpio, linux-hwmon, linux-pwm, linux-watchdog, lkml

On Tue, 28 Jul 2020, Uwe Kleine-König wrote:
On Tue, Jul 28, 2020 at 10:21:22AM +0200, Michael Walle wrote:
quoted
Am 2020-07-28 09:43, schrieb Uwe Kleine-König:
quoted
On Sun, Jul 26, 2020 at 01:18:27AM +0200, Michael Walle wrote:
quoted
+static int sl28cpld_pwm_probe(struct platform_device *pdev)
+{
+	struct sl28cpld_pwm *priv;
+	struct pwm_chip *chip;
+	int ret;
+
+	if (!pdev->dev.parent)
+		return -ENODEV;
+
+	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	if (!priv->regmap)
Error message here?
This shouldn't really happen and I put it into the same category
as the two above and report no error. But I can add it.
For kzalloc it is right to not emit an error because a failing kzalloc
is already loud on its own. I missed the first error path, that should
get a message, too.
quoted
Generally, it looked to me that more and more drivers don't
really report errors anymore, but just return with an -EWHATEVER.
So if someone can shed some light here, I'm all ears.
IMHO it's wrong not to add error messages. At one point in time it will
fail and then you're happy if you don't have to add printks all over the
place first to debug that.
Error messages should only be omitted for -ENOMEM and if something is
already being printed out, ideally by the sub-system API.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help