All of lore.kernel.org
 help / color / mirror / Atom feed
From: "a.shimko" <artyom.shimko@gmail.com>
To: linux-hwmon@vger.kernel.org
Cc: "a.shimko" <artyom.shimko@gmail.com>,
	linux-kernel@vger.kernel.org, sudeep.holla@arm.com,
	cristian.marussi@arm.com, jdelvare@suse.com,
	guenter.roeck@linux.com
Subject: [PATCH 1/3] hwmon: scmi: Add default case with debug output
Date: Tue,  5 Aug 2025 15:43:57 +0300	[thread overview]
Message-ID: <20250805125003.12573-2-artyom.shimko@gmail.com> (raw)
In-Reply-To: <20250805125003.12573-1-artyom.shimko@gmail.com>

From: Artem Shimko <artyom.shimko@gmail.com>

Improve handling of unsupported sensor types:
- Add default case in sensor type switch statement
- Log skipped sensors with debug information including:
  * Sensor ID
  * Sensor type
  * Sensor name (if available)
- Use rate-limited dev_dbg for safety

Debug output format:
"Skipping unsupported sensor ID:%d Type:%d (%s)"

Signed-off-by: Artem Shimko <artyom.shimko@gmail.com>
---
 drivers/hwmon/scmi-hwmon.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
index 364199b332c0..a3b5b5c0ec25 100644
--- a/drivers/hwmon/scmi-hwmon.c
+++ b/drivers/hwmon/scmi-hwmon.c
@@ -275,6 +275,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
 			nr_count[type]++;
 			break;
 		}
+		default:
+			dev_dbg(dev, "Skipping unsupported sensor ID:%d Type:%d (%s)\n",
+				i, sensor->type, sensor->name ? sensor->name : "unnamed");
+			continue;
 	}
 
 	if (nr_count[hwmon_temp])
@@ -323,6 +327,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
 			idx = --nr_count[type];
 			*(scmi_sensors->info[type] + idx) = sensor;
 			break;
+		default:
+			dev_dbg(dev, "Skipping unsupported sensor ID:%d Type:%d (%s)\n",
+				i, sensor->type, sensor->name ? sensor->name : "unnamed");
+			continue;
 		}
 	}
 
-- 
2.43.0


  reply	other threads:[~2025-08-05 12:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05 12:43 [PATCH v2 0/3] hwmon: scmi: Driver improvements and fixes a.shimko
2025-08-05 12:43 ` a.shimko [this message]
2025-08-05 13:10   ` [PATCH 1/3] hwmon: scmi: Add default case with debug output Guenter Roeck
2025-08-06 15:12   ` kernel test robot
2025-08-05 12:43 ` [PATCH 2/3] hwmon: scmi: Remove redundant devm_kfree call a.shimko
2025-08-05 13:13   ` Guenter Roeck
2025-08-05 12:43 ` [PATCH 3/3] hwmon: scmi: Enhance error reporting with dev_err_probe a.shimko
2025-08-05 13:20   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250805125003.12573-2-artyom.shimko@gmail.com \
    --to=artyom.shimko@gmail.com \
    --cc=cristian.marussi@arm.com \
    --cc=guenter.roeck@linux.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.