[PATCH v2 4/4] hwmon: (asus_rog_ryujin) Handle missing driver data

Arie Miller <[email protected]>
Newsgroups org.kernel.vger.linux-hwmon,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Handles an issue reported by Sashiko where an id could
be missing driver_data.

Link: https://lore.kernel.org/r/[email protected]
Assisted-by: Codex:gpt-5.6-sol sparse
Signed-off-by: Arie Miller <[email protected]>
---
 drivers/hwmon/asus_rog_ryujin.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hwmon/asus_rog_ryujin.c b/drivers/hwmon/asus_rog_ryujin.c
index 9b34c6e06bf7..702edb831394 100644
--- a/drivers/hwmon/asus_rog_ryujin.c
+++ b/drivers/hwmon/asus_rog_ryujin.c
@@ -506,6 +506,9 @@ static int rog_ryujin_probe(struct hid_device *hdev, const struct hid_device_id
 	struct rog_ryujin_data *priv;
 	int ret;
 
+	if (!id->driver_data)
+		return -EINVAL;
+
 	priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.