From patchwork Fri Jul 7 01:03:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13304320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC186EB64D9 for ; Fri, 7 Jul 2023 01:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbjGGBEB (ORCPT ); Thu, 6 Jul 2023 21:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbjGGBEA (ORCPT ); Thu, 6 Jul 2023 21:04:00 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CD5D172B; Thu, 6 Jul 2023 18:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1688691815; x=1689296615; i=w_armin@gmx.de; bh=5882YwYHfG/JJxzZayJ8NZBGgsdnPI/wsZ7JwnWwUvo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=rKFY3UKreNqlHVa9m7ibtqNC4hZyCTYpmbcYEHkBBdgfcDuZvmV5pHSSYxMiLHqTvPcMzQq w050oaxBvvb431Qlba9cSX8TVc41l06we5Yl00QmSAEivuGBQLTfSflZ3FWbbfbxabhBc5e9d c2i6NE4zBUc2uAgu5qkYSzH8LRf6YiUKdOvLnlCLpl3IdAVVQDucKl7U8/Tr/iftiQWywuLsL 0kijFXMPs1W0VFsOMgk+8UcvWuYi7tGormMLiFK20qS5QlQSVQf21rGKKX9Ch06OEdTgM6oUN kclJWM04Zf4O+vn1IE6LUKm/JVbYG/mC5Hy1qPESdKTWuKexBMjg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from esprimo-mx.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N5G9n-1pppsg0TQb-0117WS; Fri, 07 Jul 2023 03:03:35 +0200 From: Armin Wolf To: hdegoede@redhat.com, markgross@kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] platform/x86: dell-ddv: Improve error handling Date: Fri, 7 Jul 2023 03:03:32 +0200 Message-Id: <20230707010333.12954-1-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Provags-ID: V03:K1:GciWBDV2OMvqV9LClnMebCWS3o42rBZCi9eifhwPnqwUFyXawaR jVsJB9Owq9G0gj0A6o9TerEqF4bMYPC/XIuXXxpgA2ki+XA37WBrK/VwV23RODWXrj4gLbC 73PQZW+8CusSo5Y1NZidx4XwTZ1F/dFNXHn6S12d+sXYT9D8dlvdtHliw3HDqgsJhdnnFDK Y2YHtk5VwIdg/2L0jEcQQ== UI-OutboundReport: notjunk:1;M01:P0:rL4xnUL/AgA=;5oAYG5vEAbGqd6twCiNcj2IXbhu wBCWN7evla+ZTLJW/l+5ws3RvsHvJ8TVv68aoyPWU3WS/aLEzej7WKmy7x0Aw3zG0TxO8ajI/ n/K/Nl85g8oslZkmW4uwTXyJK7+nSstwHMSAOZg4GxjtiT/tbPFvZZhSRI2ikYtuni8Wqp8s0 JgFrkWugiHgKifjyGQgZ3hyHIMK5s7II6+1hlkRoJw3kjBGwgFxvUHqFkW1FtfXjYGRh+0JGw 7fXI1lWonziK08fggqf5LCj6R2zkwXGUzX0rePZ0H4SSclA2V8kYeuhOvJw4ef+MjPI/N6jSY yiPKVDEzgoNtTqJJsgHgPFUQHREsnunziosgdIDdf7nj1sex1Xg0u0MoLxUFgJVOdg03TPy3d FbKip5j/F8qVwdFWUOgSEY3haTtvJoxycEXRA9Rvma1QpgI2hsvfgpKuUNuYbFUmTPvN9eiFN DDwR8ItD4lK6qZdcFHc71y2OJq4rIt1H29lmxQssy9zaEOAh2wgcgjzz/yQyCDnGJ11M22oPy JVOwy3C35ye9SOkNPL+Dv0mxokEmxrMwoNX1/zqrJNvVsoS/l2j0ybDpvcbu0sI/4ln1r+KxT gmcGQiLO1nQ/0C9dnoemPnPDZYVjZ4ZTbGGANIyCiRI3SIIyafmmKs4XoRQuJsHn6Ms5WGHfu Dd5FS7DV7q/kCWuG4CmIJEUda9Fj/b6BKDDAcXO21BKxnhqA/It+HCAiZQrdTiOjecqI0jcQy oIn75cwnSTYvwjBuquKuNO7qZAx7OHKwBcYSVocF3NR8mWUeGvoTzR6plo4e/g+ybXxuSAKQL iMxizB4pD5Jf4qBCk5esdiBEVb8ZHe6Who1Nf7/ER2S8bC36MbAFqrVL1vxOnVK8C3LbRS4r9 ZyKWUejeW2rNHJOeyiimmazXViEE+IF12E/hEhDbBhkkOGNxRlpo7NBOb7shjjBr0JDap/JNQ DABP8/wyoW4qFg5VFrgPA7s1aBU= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org If for some reason a external function returns -ENODEV, no error message is being displayed because the driver assumes that -ENODEV can only be returned internally if no sensors, etc where found. Fix this by explicitly returning 0 in such a case since missing hardware is no error. Also remove the now obsolete check for -ENODEV. Signed-off-by: Armin Wolf --- drivers/platform/x86/dell/dell-wmi-ddv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c index 2750dee99c3e..db1e9240dd02 100644 --- a/drivers/platform/x86/dell/dell-wmi-ddv.c +++ b/drivers/platform/x86/dell/dell-wmi-ddv.c @@ -616,7 +616,8 @@ static int dell_wmi_ddv_hwmon_add(struct dell_wmi_ddv_data *data) } if (index < 2) { - ret = -ENODEV; + /* Finding no available sensors is not an error */ + ret = 0; goto err_release; } @@ -841,13 +842,13 @@ static int dell_wmi_ddv_probe(struct wmi_device *wdev, const void *context) if (IS_REACHABLE(CONFIG_ACPI_BATTERY)) { ret = dell_wmi_ddv_battery_add(data); - if (ret < 0 && ret != -ENODEV) + if (ret < 0) dev_warn(&wdev->dev, "Unable to register ACPI battery hook: %d\n", ret); } if (IS_REACHABLE(CONFIG_HWMON)) { ret = dell_wmi_ddv_hwmon_add(data); - if (ret < 0 && ret != -ENODEV) + if (ret < 0) dev_warn(&wdev->dev, "Unable to register hwmon interface: %d\n", ret); }