Skip to content

Commit 831bcbc

Browse files
Aditya Nageshliuw
authored andcommitted
Drivers: hv: Cosmetic changes for hv.c and balloon.c
Fix issues reported by checkpatch.pl script in hv.c and balloon.c - Remove unnecessary parentheses - Remove extra newlines - Remove extra spaces - Add spaces between comparison operators - Remove comparison with NULL in if statements No functional changes intended Signed-off-by: Aditya Nagesh <[email protected]> Reviewed-by: Saurabh Sengar <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Link: https://lore.kernel.org/r/1717152521-6439-1-git-send-email-adityanagesh@linux.microsoft.com Signed-off-by: Wei Liu <[email protected]> Message-ID: <1717152521-6439-1-git-send-email-adityanagesh@linux.microsoft.com>
1 parent a0b1340 commit 831bcbc

File tree

2 files changed

+53
-82
lines changed

2 files changed

+53
-82
lines changed

drivers/hv/hv.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ int hv_init(void)
4545
* This involves a hypercall.
4646
*/
4747
int hv_post_message(union hv_connection_id connection_id,
48-
enum hv_message_type message_type,
49-
void *payload, size_t payload_size)
48+
enum hv_message_type message_type,
49+
void *payload, size_t payload_size)
5050
{
5151
struct hv_input_post_message *aligned_msg;
5252
unsigned long flags;
@@ -86,7 +86,7 @@ int hv_post_message(union hv_connection_id connection_id,
8686
status = HV_STATUS_INVALID_PARAMETER;
8787
} else {
8888
status = hv_do_hypercall(HVCALL_POST_MESSAGE,
89-
aligned_msg, NULL);
89+
aligned_msg, NULL);
9090
}
9191

9292
local_irq_restore(flags);
@@ -111,7 +111,7 @@ int hv_synic_alloc(void)
111111

112112
hv_context.hv_numa_map = kcalloc(nr_node_ids, sizeof(struct cpumask),
113113
GFP_KERNEL);
114-
if (hv_context.hv_numa_map == NULL) {
114+
if (!hv_context.hv_numa_map) {
115115
pr_err("Unable to allocate NUMA map\n");
116116
goto err;
117117
}
@@ -120,11 +120,11 @@ int hv_synic_alloc(void)
120120
hv_cpu = per_cpu_ptr(hv_context.cpu_context, cpu);
121121

122122
tasklet_init(&hv_cpu->msg_dpc,
123-
vmbus_on_msg_dpc, (unsigned long) hv_cpu);
123+
vmbus_on_msg_dpc, (unsigned long)hv_cpu);
124124

125125
if (ms_hyperv.paravisor_present && hv_isolation_type_tdx()) {
126126
hv_cpu->post_msg_page = (void *)get_zeroed_page(GFP_ATOMIC);
127-
if (hv_cpu->post_msg_page == NULL) {
127+
if (!hv_cpu->post_msg_page) {
128128
pr_err("Unable to allocate post msg page\n");
129129
goto err;
130130
}
@@ -147,14 +147,14 @@ int hv_synic_alloc(void)
147147
if (!ms_hyperv.paravisor_present && !hv_root_partition) {
148148
hv_cpu->synic_message_page =
149149
(void *)get_zeroed_page(GFP_ATOMIC);
150-
if (hv_cpu->synic_message_page == NULL) {
150+
if (!hv_cpu->synic_message_page) {
151151
pr_err("Unable to allocate SYNIC message page\n");
152152
goto err;
153153
}
154154

155155
hv_cpu->synic_event_page =
156156
(void *)get_zeroed_page(GFP_ATOMIC);
157-
if (hv_cpu->synic_event_page == NULL) {
157+
if (!hv_cpu->synic_event_page) {
158158
pr_err("Unable to allocate SYNIC event page\n");
159159

160160
free_page((unsigned long)hv_cpu->synic_message_page);
@@ -203,14 +203,13 @@ int hv_synic_alloc(void)
203203
return ret;
204204
}
205205

206-
207206
void hv_synic_free(void)
208207
{
209208
int cpu, ret;
210209

211210
for_each_present_cpu(cpu) {
212-
struct hv_per_cpu_context *hv_cpu
213-
= per_cpu_ptr(hv_context.cpu_context, cpu);
211+
struct hv_per_cpu_context *hv_cpu =
212+
per_cpu_ptr(hv_context.cpu_context, cpu);
214213

215214
/* It's better to leak the page if the encryption fails. */
216215
if (ms_hyperv.paravisor_present && hv_isolation_type_tdx()) {
@@ -262,8 +261,8 @@ void hv_synic_free(void)
262261
*/
263262
void hv_synic_enable_regs(unsigned int cpu)
264263
{
265-
struct hv_per_cpu_context *hv_cpu
266-
= per_cpu_ptr(hv_context.cpu_context, cpu);
264+
struct hv_per_cpu_context *hv_cpu =
265+
per_cpu_ptr(hv_context.cpu_context, cpu);
267266
union hv_synic_simp simp;
268267
union hv_synic_siefp siefp;
269268
union hv_synic_sint shared_sint;
@@ -277,8 +276,8 @@ void hv_synic_enable_regs(unsigned int cpu)
277276
/* Mask out vTOM bit. ioremap_cache() maps decrypted */
278277
u64 base = (simp.base_simp_gpa << HV_HYP_PAGE_SHIFT) &
279278
~ms_hyperv.shared_gpa_boundary;
280-
hv_cpu->synic_message_page
281-
= (void *)ioremap_cache(base, HV_HYP_PAGE_SIZE);
279+
hv_cpu->synic_message_page =
280+
(void *)ioremap_cache(base, HV_HYP_PAGE_SIZE);
282281
if (!hv_cpu->synic_message_page)
283282
pr_err("Fail to map synic message page.\n");
284283
} else {
@@ -296,8 +295,8 @@ void hv_synic_enable_regs(unsigned int cpu)
296295
/* Mask out vTOM bit. ioremap_cache() maps decrypted */
297296
u64 base = (siefp.base_siefp_gpa << HV_HYP_PAGE_SHIFT) &
298297
~ms_hyperv.shared_gpa_boundary;
299-
hv_cpu->synic_event_page
300-
= (void *)ioremap_cache(base, HV_HYP_PAGE_SIZE);
298+
hv_cpu->synic_event_page =
299+
(void *)ioremap_cache(base, HV_HYP_PAGE_SIZE);
301300
if (!hv_cpu->synic_event_page)
302301
pr_err("Fail to map synic event page.\n");
303302
} else {
@@ -348,8 +347,8 @@ int hv_synic_init(unsigned int cpu)
348347
*/
349348
void hv_synic_disable_regs(unsigned int cpu)
350349
{
351-
struct hv_per_cpu_context *hv_cpu
352-
= per_cpu_ptr(hv_context.cpu_context, cpu);
350+
struct hv_per_cpu_context *hv_cpu =
351+
per_cpu_ptr(hv_context.cpu_context, cpu);
353352
union hv_synic_sint shared_sint;
354353
union hv_synic_simp simp;
355354
union hv_synic_siefp siefp;

0 commit comments

Comments
 (0)