diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index d5477c0d730a343dc66ead69f30a479030922fa0..da187e635ea3f485ac8b69e6f414fa69313095ca 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -917,8 +917,10 @@ static int tcmu_configure_device(struct se_device *dev) if (ret) goto err_register; + /* User can set hw_block_size before enable the device */ + if (dev->dev_attrib.hw_block_size == 0) + dev->dev_attrib.hw_block_size = 512; /* Other attributes can be configured in userspace */ - dev->dev_attrib.hw_block_size = 512; dev->dev_attrib.hw_max_sectors = 128; dev->dev_attrib.hw_queue_depth = 128;