From patchwork Fri Apr 12 14:05:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 10898459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5DD617E0 for ; Fri, 12 Apr 2019 14:05:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD77E28D5E for ; Fri, 12 Apr 2019 14:05:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E30C28D77; Fri, 12 Apr 2019 14:05:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31A3028D64 for ; Fri, 12 Apr 2019 14:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726714AbfDLOF3 (ORCPT ); Fri, 12 Apr 2019 10:05:29 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33594 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfDLOF2 (ORCPT ); Fri, 12 Apr 2019 10:05:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2D4CE374; Fri, 12 Apr 2019 07:05:28 -0700 (PDT) Received: from e110467-lin.cambridge.arm.com (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C7D433F557; Fri, 12 Apr 2019 07:05:26 -0700 (PDT) From: Robin Murphy To: linux@roeck-us.net, kamil@wypas.org, b.zolnierkie@samsung.com, jdelvare@suse.com Cc: stefan.wahren@i2se.com, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND] hwmon: pwm-fan: Report probe errors consistently Date: Fri, 12 Apr 2019 15:05:23 +0100 Message-Id: <69fabb7ca6c9d4a8f9c18bcf298d2ce9502a9547.1555069101.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.21.0.dirty MIME-Version: 1.0 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Printing the error code for a failure provides a head-start for debugging, since it's often sufficient to pinpoint the origin of the failure. We already do this for some probe-failure messages, so let's make the rest of them consistent. Signed-off-by: Robin Murphy --- This is based on Stefan's "[PATCH V5 3/3] hwmon: pwm-fan: Add RPM support via external interrupt" drivers/hwmon/pwm-fan.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c index 8c4c5eefd4ca..556db4bef743 100644 --- a/drivers/hwmon/pwm-fan.c +++ b/drivers/hwmon/pwm-fan.c @@ -330,7 +330,7 @@ static int pwm_fan_probe(struct platform_device *pdev) ret = pwm_apply_state(ctx->pwm, &state); if (ret) { - dev_err(&pdev->dev, "Failed to configure PWM\n"); + dev_err(&pdev->dev, "Failed to configure PWM: %d\n", ret); goto err_reg_disable; } @@ -348,7 +348,8 @@ static int pwm_fan_probe(struct platform_device *pdev) ret = devm_request_irq(&pdev->dev, ctx->irq, pulse_handler, 0, pdev->name, ctx); if (ret) { - dev_err(&pdev->dev, "Can't get interrupt working.\n"); + dev_err(&pdev->dev, + "Failed to request interrupt: %d\n", ret); goto err_pwm_disable; } ctx->sample_start = ktime_get(); @@ -358,8 +359,9 @@ static int pwm_fan_probe(struct platform_device *pdev) hwmon = devm_hwmon_device_register_with_groups(&pdev->dev, "pwmfan", ctx, pwm_fan_groups); if (IS_ERR(hwmon)) { - dev_err(&pdev->dev, "Failed to register hwmon device\n"); ret = PTR_ERR(hwmon); + dev_err(&pdev->dev, + "Failed to register hwmon device: %d\n", ret); goto err_del_timer; } @@ -373,9 +375,10 @@ static int pwm_fan_probe(struct platform_device *pdev) "pwm-fan", ctx, &pwm_fan_cooling_ops); if (IS_ERR(cdev)) { - dev_err(&pdev->dev, - "Failed to register pwm-fan as cooling device"); ret = PTR_ERR(cdev); + dev_err(&pdev->dev, + "Failed to register pwm-fan as cooling device: %d\n", + ret); goto err_del_timer; } ctx->cdev = cdev;