diff --git a/block/partitions/core.c b/block/partitions/core.c
index d5f5633bf72577f769ea6e99f2981111fd4602d1..82d26427deae2577162290cd4d8f2f503be02560 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -288,7 +288,7 @@ static ssize_t whole_disk_show(struct device *dev,
 {
 	return 0;
 }
-static DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL);
+static const DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL);
 
 /*
  * Must be called either with open_mutex held, before a disk can be opened or