Commit d66ba15b authored by Reza Arbab's avatar Reza Arbab Committed by Linus Torvalds
Browse files

memory-hotplug: fix store_mem_state() return value

If store_mem_state() is called to online memory which is already online,
it will return 1, the value it got from device_online().

This is wrong because store_mem_state() is a device_attribute .store
function.  Thus a non-negative return value represents input bytes read.

Set the return value to -EINVAL in this case.


Signed-off-by: default avatarReza Arbab <>
Cc: Greg Kroah-Hartman <>
Cc: Vlastimil Babka <>
Cc: Vitaly Kuznetsov <>
Cc: David Rientjes <>
Cc: Yaowei Bai <>
Cc: Joonsoo Kim <>
Cc: Dan Williams <>
Cc: Xishi Qiu <>
Cc: David Vrabel <>
Cc: Chen Yucong <>
Cc: Andrew Banman <>
Cc: Seth Jennings <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 0247f3f4
...@@ -361,8 +361,11 @@ store_mem_state(struct device *dev, ...@@ -361,8 +361,11 @@ store_mem_state(struct device *dev,
err: err:
unlock_device_hotplug(); unlock_device_hotplug();
if (ret) if (ret < 0)
return ret; return ret;
if (ret)
return -EINVAL;
return count; return count;
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment