diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 538ff697a4cfe28bb27a8c1c7e87391c7d894415..e9e87d337446918f672771551f41041755d83d22 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -827,7 +827,8 @@ static int hid_scan_report(struct hid_device *hid)
 				 * hid-rmi should take care of them,
 				 * not hid-generic
 				 */
-				hid->group = HID_GROUP_RMI;
+				if (IS_ENABLED(CONFIG_HID_RMI))
+					hid->group = HID_GROUP_RMI;
 		break;
 	}