diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 6752b9178a396780762bde612a8983aa62ae261b..2aa87cbdede0ed19b77c8e4aaffea2c2d8146758 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -165,7 +165,7 @@ static ssize_t pid_show(struct device *dev,
 	return sprintf(buf, "%d\n", task_pid_nr(nbd->task_recv));
 }
 
-static struct device_attribute pid_attr = {
+static const struct device_attribute pid_attr = {
 	.attr = { .name = "pid", .mode = S_IRUGO},
 	.show = pid_show,
 };