aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing/intel_th/msu.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-12-22 15:15:05 -0800
committerDavid S. Miller <davem@davemloft.net>2019-12-22 15:15:05 -0800
commitac80010fc94eb0680d9a432b639583bd7ac29066 (patch)
tree2de924c048910abfbfff52a3d5188a790ead379f /drivers/hwtracing/intel_th/msu.c
parentMerge tag 'wireless-drivers-next-2019-12-20' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next (diff)
parentMerge tag 'xfs-5.5-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux (diff)
downloadlinux-dev-ac80010fc94eb0680d9a432b639583bd7ac29066.tar.xz
linux-dev-ac80010fc94eb0680d9a432b639583bd7ac29066.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Mere overlapping changes in the conflicts here. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/hwtracing/intel_th/msu.c')
-rw-r--r--drivers/hwtracing/intel_th/msu.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index 6d240dfae9d9..8e48c7458aa3 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -1676,10 +1676,13 @@ static int intel_th_msc_init(struct msc *msc)
return 0;
}
-static void msc_win_switch(struct msc *msc)
+static int msc_win_switch(struct msc *msc)
{
struct msc_window *first;
+ if (list_empty(&msc->win_list))
+ return -EINVAL;
+
first = list_first_entry(&msc->win_list, struct msc_window, entry);
if (msc_is_last_win(msc->cur_win))
@@ -1691,6 +1694,8 @@ static void msc_win_switch(struct msc *msc)
msc->base_addr = msc_win_base_dma(msc->cur_win);
intel_th_trace_switch(msc->thdev);
+
+ return 0;
}
/**
@@ -2025,16 +2030,15 @@ win_switch_store(struct device *dev, struct device_attribute *attr,
if (val != 1)
return -EINVAL;
+ ret = -EINVAL;
mutex_lock(&msc->buf_mutex);
/*
* Window switch can only happen in the "multi" mode.
* If a external buffer is engaged, they have the full
* control over window switching.
*/
- if (msc->mode != MSC_MODE_MULTI || msc->mbuf)
- ret = -ENOTSUPP;
- else
- msc_win_switch(msc);
+ if (msc->mode == MSC_MODE_MULTI && !msc->mbuf)
+ ret = msc_win_switch(msc);
mutex_unlock(&msc->buf_mutex);
return ret ? ret : size;