[PATCH] xen/x2apic: Fix inconsistent indenting

2022-02-07 Thread Jiapeng Chong
Eliminate the follow smatch warning:

arch/x86/xen/enlighten_hvm.c:189 xen_cpu_dead_hvm() warn: inconsistent
indenting.

Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
 arch/x86/xen/enlighten_hvm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
index 6448c5071117..6f4c9b57eda8 100644
--- a/arch/x86/xen/enlighten_hvm.c
+++ b/arch/x86/xen/enlighten_hvm.c
@@ -185,8 +185,7 @@ static int xen_cpu_dead_hvm(unsigned int cpu)
 
if (xen_have_vector_callback && xen_feature(XENFEAT_hvm_safe_pvclock))
xen_teardown_timer(cpu);
-
-   return 0;
+   return 0;
 }
 
 static bool no_vector_callback __initdata;
-- 
2.20.1.7.g153144c




[PATCH] x86/xen: Fix kerneldoc warning

2022-03-06 Thread Jiapeng Chong
Fix the following W=1 kernel warnings:

arch/x86/xen/setup.c:725: warning: expecting prototype for
machine_specific_memory_setup(). Prototype was for xen_memory_setup()
instead.

Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
 arch/x86/xen/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index af216feb63d9..81aa46f770c5 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -719,7 +719,7 @@ static void __init xen_reserve_xen_mfnlist(void)
 }
 
 /**
- * machine_specific_memory_setup - Hook for machine specific memory setup.
+ * xen_memory_setup - Hook for machine specific memory setup.
  **/
 char * __init xen_memory_setup(void)
 {
-- 
2.20.1.7.g153144c




[PATCH] xen-netback: Remove set but unused variable 'pending_idx'

2022-12-08 Thread Jiapeng Chong
Variable pending_idx is not effectively used in the function, so delete
it.

drivers/net/xen-netback/netback.c:886:7: warning: variable ‘pending_idx’ set 
but not used.

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3399
Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
 drivers/net/xen-netback/netback.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/xen-netback/netback.c 
b/drivers/net/xen-netback/netback.c
index 054ac0e897f6..19d928389473 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -883,7 +883,6 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
struct xen_netif_tx_request txfrags[XEN_NETBK_LEGACY_SLOTS_MAX];
struct xen_netif_extra_info extras[XEN_NETIF_EXTRA_TYPE_MAX-1];
unsigned int extra_count;
-   u16 pending_idx;
RING_IDX idx;
int work_to_do;
unsigned int data_len;
@@ -984,7 +983,6 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
}
 
index = pending_index(queue->pending_cons);
-   pending_idx = queue->pending_ring[index];
 
if (ret >= XEN_NETBK_LEGACY_SLOTS_MAX - 1 && data_len < 
txreq.size)
data_len = txreq.size;
-- 
2.20.1.7.g153144c




[PATCH] x86/xen: Remove the unused function p2m_top_mfn_init()

2022-12-27 Thread Jiapeng Chong
The function p2m_top_mfn_init is defined in the p2m.c file,
but not called elsewhere, so remove this unused function.

arch/x86/xen/p2m.c:137:24: warning: unused function 'p2m_index'.

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3557
Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
 arch/x86/xen/p2m.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 58db86f7b384..9bdc3b656b2c 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -134,11 +134,6 @@ static inline unsigned p2m_mid_index(unsigned long pfn)
return (pfn / P2M_PER_PAGE) % P2M_MID_PER_PAGE;
 }
 
-static inline unsigned p2m_index(unsigned long pfn)
-{
-   return pfn % P2M_PER_PAGE;
-}
-
 static void p2m_top_mfn_init(unsigned long *top)
 {
unsigned i;
-- 
2.20.1.7.g153144c




[PATCH v2] x86/xen: Remove the unused function p2m_index()

2023-01-05 Thread Jiapeng Chong
The function p2m_index is defined in the p2m.c file, but not called
elsewhere, so remove this unused function.

arch/x86/xen/p2m.c:137:24: warning: unused function 'p2m_index'.

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3557
Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
Changes in v2:
  -Modify title and submission.

 arch/x86/xen/p2m.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 58db86f7b384..9bdc3b656b2c 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -134,11 +134,6 @@ static inline unsigned p2m_mid_index(unsigned long pfn)
return (pfn / P2M_PER_PAGE) % P2M_MID_PER_PAGE;
 }
 
-static inline unsigned p2m_index(unsigned long pfn)
-{
-   return pfn % P2M_PER_PAGE;
-}
-
 static void p2m_top_mfn_init(unsigned long *top)
 {
unsigned i;
-- 
2.20.1.7.g153144c




[PATCH] drivers: net: xen-netfront: Simplify the calculation of variables

2021-02-02 Thread Jiapeng Chong
Fix the following coccicheck warnings:

./drivers/net/xen-netfront.c:1816:52-54: WARNING !A || A && B is
equivalent to !A || B.

Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
 drivers/net/xen-netfront.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index b01848e..5158841 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1813,7 +1813,7 @@ static int setup_netfront(struct xenbus_device *dev,
 *  a) feature-split-event-channels == 0
 *  b) feature-split-event-channels == 1 but failed to setup
 */
-   if (!feature_split_evtchn || (feature_split_evtchn && err))
+   if (!feature_split_evtchn || err)
err = setup_netfront_single(queue);
 
if (err)
-- 
1.8.3.1




[PATCH] xen/evtchn: replace if (cond) BUG() with BUG_ON()

2021-03-16 Thread Jiapeng Chong
Fix the following coccicheck warnings:

./drivers/xen/evtchn.c:412:2-5: WARNING: Use BUG_ON instead of if
condition followed by BUG.

Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
 drivers/xen/evtchn.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
index c99415a..b1c59bc 100644
--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -408,8 +408,7 @@ static int evtchn_bind_to_user(struct per_user_data *u, 
evtchn_port_t port)
 err:
/* bind failed, should close the port now */
close.port = port;
-   if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
-   BUG();
+   BUG_ON(HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0);
del_evtchn(u, evtchn);
return rc;
 }
-- 
1.8.3.1




[PATCH] xen/x86: Remove duplicate include

2024-03-21 Thread Jiapeng Chong
./arch/x86/xen/enlighten.c: linux/memblock.h is included more than once.

Reported-by: Abaci Robot 
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=8610
Signed-off-by: Jiapeng Chong 
---
 arch/x86/xen/enlighten.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index a01ca255b0c6..5f3a69f6ec34 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1,8 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
-#include 
-#endif
 #include 
 #include 
 #include 
-- 
2.20.1.7.g153144c