diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-11-08 08:51:52 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-11-08 08:51:52 -0800 |
commit | fa8e2458ecfc959cd627e25ba86d8eddcb63c887 (patch) | |
tree | d8c9dec3dac8e97e8591e6507a619959449d6344 /drivers/target/target_core_device.c | |
parent | d56a289be2ce01d1aa426a6cf45dede14a8db41e (diff) | |
parent | 3d70f8c617a436c7146ecb81df2265b4626dfe89 (diff) | |
download | linux-stable-fa8e2458ecfc959cd627e25ba86d8eddcb63c887.tar.gz linux-stable-fa8e2458ecfc959cd627e25ba86d8eddcb63c887.tar.bz2 linux-stable-fa8e2458ecfc959cd627e25ba86d8eddcb63c887.zip |
Merge tag 'v3.7-rc4' into next to sync up Wacom bits
Linux 3.7-rc4
Diffstat (limited to 'drivers/target/target_core_device.c')
-rw-r--r-- | drivers/target/target_core_device.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 8d774da16320..9abef9f8eb76 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -850,20 +850,20 @@ int se_dev_check_shutdown(struct se_device *dev) static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) { - u32 tmp, aligned_max_sectors; + u32 aligned_max_sectors; + u32 alignment; /* * Limit max_sectors to a PAGE_SIZE aligned value for modern * transport_allocate_data_tasks() operation. */ - tmp = rounddown((max_sectors * block_size), PAGE_SIZE); - aligned_max_sectors = (tmp / block_size); - if (max_sectors != aligned_max_sectors) { - printk(KERN_INFO "Rounding down aligned max_sectors from %u" - " to %u\n", max_sectors, aligned_max_sectors); - return aligned_max_sectors; - } + alignment = max(1ul, PAGE_SIZE / block_size); + aligned_max_sectors = rounddown(max_sectors, alignment); + + if (max_sectors != aligned_max_sectors) + pr_info("Rounding down aligned max_sectors from %u to %u\n", + max_sectors, aligned_max_sectors); - return max_sectors; + return aligned_max_sectors; } void se_dev_set_default_attribs( |