diff options
author | Kimberly Brown <kimbrownkd@gmail.com> | 2019-03-14 16:05:00 -0400 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2019-04-10 18:58:56 -0400 |
commit | fcedbb293ee4d67399a6c231c5e8b7ceecfac9bf (patch) | |
tree | c2eaa2f29e8042fa607f3d2374f44c601fdab7d4 /samples | |
parent | 46fc15487d02451448c11b83c4d086d87a6ad588 (diff) | |
download | blackbird-op-linux-fcedbb293ee4d67399a6c231c5e8b7ceecfac9bf.tar.gz blackbird-op-linux-fcedbb293ee4d67399a6c231c5e8b7ceecfac9bf.zip |
Drivers: hv: vmbus: Refactor chan->state if statement
The chan->state "if statement" was introduced in commit 6712cc9c2211
("vmbus: don't return values for uninitalized channels"). That commit
states that the purpose of the chan->state "if statement" is to prevent
returning garbage or causing a kernel OOPS when the channel ring buffer
is not initialized. The changes in this patch provide the same
protection.
Refactor the chan->state “if statement” in vmbus_chan_attr_show():
- Instead of checking the channel state in the "if statement", check
whether the channel ring buffer pointer is NULL. Checking the
ring buffer pointer makes this code consistent with
hv_ringbuffer_get_debuginfo().
- Move the "if statement" to the four "_show" functions that access a
channel ring buffer. Only four of the channel-level "_show" functions
access a ring buffer. The ring buffer pointer does not need to be
checked before calling the other "_show" functions, and moving the
ring buffer pointer "if statement" to the "_show" functions that
access a ring buffer makes the purpose of the "if statement" clear.
Signed-off-by: Kimberly Brown <kimbrownkd@gmail.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions