Add improvements suggested by checkpatch for vmbus_drv
Subsystems (2)
cover Add improvements suggested by checkpatch for vmbus_drv
This series fixes some warnings edmited by the checkpatch in the file vmbus_drv.c. I thought it would be good to split each fix into a commit to help with the review.
Matheus Castello (6):
drivers: hv: Fix hyperv_record_panic_msg path on comment
drivers: hv: vmbus: Replace symbolic permissions by octal permissions
drivers: hv: vmbus: Fix checkpatch LINE_SPACING
drivers: hv: vmbus: Fix checkpatch SPLIT_STRING
drivers: hv: vmbus: Fix unnecessary OOM_MESSAGE
drivers: hv: vmbus: Fix call msleep using < 20ms
drivers/hv/vmbus_drv.c | 55 +++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 25 deletions(-)
--
2.28.0
PATCH 1/6 drivers: hv: Fix hyperv_record_panic_msg path on comment
Fix the kernel parameter path in the comment, in the documentation the parameter is correct but if someone who is studying the code and see this first can get confused and try to access the wrong path/parameter
--- drivers/hv/vmbus_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hv/vmbus_drv.c +1 -1
@@ -55,7 +55,7 @@ int vmbus_interrupt;/* * Boolean to control whether to report panic messages over Hyper-V. * -* It can be set via /proc/sys/kernel/hyperv/record_panic_msg +* It can be set via /proc/sys/kernel/hyperv_record_panic_msg */ static int sysctl_record_panic_msg =1 ;
--
2.28.0
RE: [PATCH 1/6] drivers: hv: Fix hyperv_record_panic_msg path on comment
From: Matheus Castello <[email protected]> Sent: Sunday, November 15, 2020 11:57 AM
Quoted 24 lines
Fix the kernel parameter path in the comment, in the documentation the parameter is correct but if someone who is studying the code and see this first can get confused and try to access the wrong path/parameter
Signed-off-by Matheus Castello <[email protected]>--- drivers/hv/vmbus_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hv/vmbus_drv.c +1
-2@@ -55,7 +55,7 @@ int vmbus_interrupt;/* * Boolean to control whether to report panic messages over Hyper-V. * -* It can be set via /proc/sys/kernel/hyperv/record_panic_msg +* It can be set via /proc/sys/kernel/hyperv_record_panic_msg */ static int sysctl_record_panic_msg =1 ; --
Quoted 1 line
2.28.0
PATCH 2/6 drivers: hv: vmbus: Replace symbolic permissions by octal permissions
In reply to Matheus CastelloThis fixed the below checkpatch issue:
WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
--- drivers/hv/vmbus_drv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hv/vmbus_drv.c +5 -5
@@ -1812,7 +1812,7 @@ static ssize_t channel_pending_show(struct vmbus_channel *channel,channel_pending (channel, vmbus_connection.monitor_pages[1])); } -static VMBUS_CHAN_ATTR(pending, S_IRUGO, channel_pending_show, NULL); +static VMBUS_CHAN_ATTR(pending, 0444, channel_pending_show, NULL);static ssize_t channel_latency_show (struct vmbus_channel *channel,char *buf)
@@ -1821,19 +1821,19 @@ static ssize_t channel_latency_show(struct vmbus_channel *channel,channel_latency (channel, vmbus_connection.monitor_pages[1])); } -static VMBUS_CHAN_ATTR(latency, S_IRUGO, channel_latency_show, NULL); +static VMBUS_CHAN_ATTR(latency, 0444, channel_latency_show, NULL);static ssize_t channel_interrupts_show (struct vmbus_channel *channel,char *buf) {return sprintf (buf,"%llu\n" , channel->interrupts); } -static VMBUS_CHAN_ATTR(interrupts, S_IRUGO, channel_interrupts_show, NULL); +static VMBUS_CHAN_ATTR(interrupts, 0444, channel_interrupts_show, NULL);static ssize_t channel_events_show (struct vmbus_channel *channel,char *buf) {return sprintf (buf,"%llu\n" , channel->sig_events); } -static VMBUS_CHAN_ATTR(events, S_IRUGO, channel_events_show, NULL); +static VMBUS_CHAN_ATTR(events, 0444, channel_events_show, NULL);static ssize_t channel_intr_in_full_show (struct vmbus_channel *channel,char *buf)
@@ -1872,7 +1872,7 @@ static ssize_t subchannel_monitor_id_show(struct vmbus_channel *channel, {return sprintf (buf,"%u\n" , channel->offermsg.monitorid); } -static VMBUS_CHAN_ATTR(monitor_id, S_IRUGO, subchannel_monitor_id_show, NULL); +static VMBUS_CHAN_ATTR(monitor_id, 0444, subchannel_monitor_id_show, NULL);static ssize_t subchannel_id_show (struct vmbus_channel *channel,char *buf)
--
2.28.0
RE: [PATCH 2/6] drivers: hv: vmbus: Replace symbolic permissions by octal permissions
From: Matheus Castello <[email protected]> Sent: Sunday, November 15, 2020 11:58 AM
Quoted 57 lines
This fixed the below checkpatch issue:
WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.Signed-off-by Matheus Castello <[email protected]>--- drivers/hv/vmbus_drv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/hv/vmbus_drv.c +1
-1@@ -1812,7 +1812,7 @@ static ssize_t channel_pending_show(struct vmbus_channel *channel,channel_pending (channel, vmbus_connection.monitor_pages[1])); } -static VMBUS_CHAN_ATTR(pending, S_IRUGO, channel_pending_show, NULL); +static VMBUS_CHAN_ATTR(pending, 0444, channel_pending_show, NULL); static ssize_t channel_latency_show(struct vmbus_channel *channel,drivers/hv/vmbus_drv.c +3
-3char *buf)@@ -1821,19 +1821,19 @@ static ssize_t channel_latency_show(struct vmbus_channel *channel,channel_latency (channel, vmbus_connection.monitor_pages[1])); } -static VMBUS_CHAN_ATTR(latency, S_IRUGO, channel_latency_show, NULL); +static VMBUS_CHAN_ATTR(latency, 0444, channel_latency_show, NULL);static ssize_t channel_interrupts_show (struct vmbus_channel *channel,char *buf) {return sprintf (buf,"%llu\n" , channel->interrupts); } -static VMBUS_CHAN_ATTR(interrupts, S_IRUGO, channel_interrupts_show, NULL); +static VMBUS_CHAN_ATTR(interrupts, 0444, channel_interrupts_show, NULL);static ssize_t channel_events_show (struct vmbus_channel *channel,char *buf) {return sprintf (buf,"%llu\n" , channel->sig_events); } -static VMBUS_CHAN_ATTR(events, S_IRUGO, channel_events_show, NULL); +static VMBUS_CHAN_ATTR(events, 0444, channel_events_show, NULL); static ssize_t channel_intr_in_full_show(struct vmbus_channel *channel,drivers/hv/vmbus_drv.c +1
-1char *buf)@@ -1872,7 +1872,7 @@ static ssize_t subchannel_monitor_id_show(struct vmbus_channel *channel, {return sprintf (buf,"%u\n" , channel->offermsg.monitorid); } -static VMBUS_CHAN_ATTR(monitor_id, S_IRUGO, subchannel_monitor_id_show, NULL); +static VMBUS_CHAN_ATTR(monitor_id, 0444, subchannel_monitor_id_show, NULL); static ssize_t subchannel_id_show(struct vmbus_channel *channel,
Quoted 3 lines
char *buf)
--
2.28.0
PATCH 3/6 drivers: hv: vmbus: Fix checkpatch LINE_SPACING
In reply to Matheus CastelloFixed checkpatch warning: Missing a blank line after declarations checkpatch(LINE_SPACING)
--- drivers/hv/vmbus_drv.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hv/vmbus_drv.c +3 -0
@@ -156,6 +156,7 @@ static u32 channel_conn_id(struct vmbus_channel *channel, {u8 monitor_group =channel_monitor_group (channel);u8 monitor_offset =channel_monitor_offset (channel); +return monitor_page->parameter[monitor_group][monitor_offset].connectionid.u.id; }
@@ -550,6 +551,7 @@ static ssize_t vendor_show(struct device *dev, char *buf) {struct hv_device *hv_dev =device_to_hv_device (dev); +return sprintf (buf,"0x%x\n" , hv_dev->vendor_id); }static DEVICE_ATTR_RO (vendor);
@@ -559,6 +561,7 @@ static ssize_t device_show(struct device *dev, char *buf) {struct hv_device *hv_dev =device_to_hv_device (dev); +return sprintf (buf,"0x%x\n" , hv_dev->device_id); }static DEVICE_ATTR_RO (device);
--
2.28.0
RE: [PATCH 3/6] drivers: hv: vmbus: Fix checkpatch LINE_SPACING
From: Matheus Castello <[email protected]> Sent: Sunday, November 15, 2020 11:58 AM
Quoted 39 lines
Fixed checkpatch warning: Missing a blank line after declarations
checkpatch(LINE_SPACING)Signed-off-by Matheus Castello <[email protected]>--- drivers/hv/vmbus_drv.c | 3 +++ 1 file changed, 3 insertions(+)drivers/hv/vmbus_drv.c +3
-1@@ -156,6 +156,7 @@ static u32 channel_conn_id(struct vmbus_channel *channel, {u8 monitor_group =channel_monitor_group (channel);u8 monitor_offset =channel_monitor_offset (channel); +return monitor_page- >parameter[monitor_group][monitor_offset].connectionid.u.id; }@@ -550,6 +551,7 @@ static ssize_t vendor_show(struct device *dev, char *buf) {struct hv_device *hv_dev =device_to_hv_device (dev); +return sprintf (buf,"0x%x\n" , hv_dev->vendor_id); }static DEVICE_ATTR_RO (vendor);@@ -559,6 +561,7 @@ static ssize_t device_show(struct device *dev, char *buf) {struct hv_device *hv_dev =device_to_hv_device (dev); +return sprintf (buf,"0x%x\n" , hv_dev->device_id); }static DEVICE_ATTR_RO (device); --
Quoted 1 line
2.28.0
PATCH 4/6 drivers: hv: vmbus: Fix checkpatch SPLIT_STRING
In reply to Matheus CastelloCheckpatch emits WARNING: quoted string split across lines. To keep the code clean and with the 80 column length indentation the check and registration code for kmsg_dump_register has been transferred to a new function hv_kmsg_dump_register.
--- drivers/hv/vmbus_drv.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)
drivers/hv/vmbus_drv.c +19 -15
@@ -1387,6 +1387,23 @@ static struct kmsg_dumper hv_kmsg_dumper = { .dump = hv_kmsg_dump, }; +static void hv_kmsg_dump_register (void ) +{ +int ret; + + hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page (); +if (hv_panic_page) { + ret =kmsg_dump_register (&hv_kmsg_dumper); +if (ret) { +pr_err ("Hyper-V: kmsg dump register error 0x%x\n" , ret); +hv_free_hyperv_page ((unsigned long )hv_panic_page); + hv_panic_page =NULL ; + } + }else { +pr_err ("Hyper-V: panic message page memory allocation failed" ); + } +} +static struct ctl_table_header *hv_ctl_table_hdr;/*
@@ -1477,21 +1494,8 @@ static int vmbus_bus_init(void)* capability is supported by the hypervisor. */ hv_get_crash_ctl (hyperv_crash_ctl); -if (hyperv_crash_ctl &HV_CRASH_CTL_CRASH_NOTIFY_MSG ) { - hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page (); -if (hv_panic_page) { - ret =kmsg_dump_register (&hv_kmsg_dumper); -if (ret) { -pr_err ("Hyper-V: kmsg dump register " -"error 0x%x\n" , ret); -hv_free_hyperv_page ( - (unsigned long )hv_panic_page); - hv_panic_page =NULL ; - } - }else -pr_err ("Hyper-V: panic message page memory " -"allocation failed" ); - } +if (hyperv_crash_ctl &HV_CRASH_CTL_CRASH_NOTIFY_MSG ) +hv_kmsg_dump_register ();register_die_notifier (&hyperv_die_block); }
--
2.28.0
RE: [PATCH 4/6] drivers: hv: vmbus: Fix checkpatch SPLIT_STRING
From: Matheus Castello <[email protected]> Sent: Sunday, November 15, 2020 11:58 AM
Quoted 26 lines
Checkpatch emits WARNING: quoted string split across lines. To keep the code clean and with the 80 column length indentation the check and registration code for
kmsg_dump_registerhas been transferred to a new functionhv_kmsg_dump_register.Signed-off-by Matheus Castello <[email protected]>--- drivers/hv/vmbus_drv.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)drivers/hv/vmbus_drv.c +7
-0@@ -1387,6 +1387,23 @@ static struct kmsg_dumper hv_kmsg_dumper = { .dump = hv_kmsg_dump, }; +static void hv_kmsg_dump_register (void ) +{ +int ret; + + hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page (); +if (hv_panic_page) { + ret =kmsg_dump_register (&hv_kmsg_dumper);
drivers/hv/vmbus_drv.c static struct kmsg_dumper hv_kmsg_dumper = { · line 1406
Quoted 10 lines
drivers/hv/vmbus_drv.c +10
-0+if (ret) { +pr_err ("Hyper-V: kmsg dump register error 0x%x\n" , ret); +hv_free_hyperv_page ((unsigned long )hv_panic_page); + hv_panic_page =NULL ; + } + }else { +pr_err ("Hyper-V: panic message page memory allocation failed" ); + } +} +
The above would be marginally better if organized as follows so that the main execution path isn't in an "if" clause. Also reduces indentation.
hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page();
if (!hv_panic_page) {
pr_err("Hyper-V: panic message page memory allocation failed");
return;
}
ret = kmsg_dump_register(&hv_kmsg_dumper);
if (ret) {
pr_err("Hyper-V: kmsg dump register error 0x%x\n", ret);
hv_free_hyperv_page((unsigned long)hv_panic_page);
hv_panic_page = NULL;
}Quoted 29 lines
drivers/hv/vmbus_drv.c +2
-16static struct ctl_table_header *hv_ctl_table_hdr;/* @@ -1477,21 +1494,8 @@ static int vmbus_bus_init(void)* capability is supported by the hypervisor. */ hv_get_crash_ctl (hyperv_crash_ctl); -if (hyperv_crash_ctl &HV_CRASH_CTL_CRASH_NOTIFY_MSG ) { - hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page (); -if (hv_panic_page) { - ret =kmsg_dump_register (&hv_kmsg_dumper); -if (ret) { -pr_err ("Hyper-V: kmsg dump register " -"error 0x%x\n" , ret); -hv_free_hyperv_page ( - (unsigned long )hv_panic_page); - hv_panic_page =NULL ; - } - }else -pr_err ("Hyper-V: panic message page memory " -"allocation failed" ); - } +if (hyperv_crash_ctl &HV_CRASH_CTL_CRASH_NOTIFY_MSG ) +hv_kmsg_dump_register ();register_die_notifier (&hyperv_die_block); } --2.28.0
Re: [PATCH 4/6] drivers: hv: vmbus: Fix checkpatch SPLIT_STRING
Hi Michael,
Em 11/15/2020 7:25 PM, Michael Kelley escreveu:
Quoted 41 lines
From: Matheus Castello <[email protected]> Sent: Sunday, November 15, 2020 11:58 AM
Quoted 26 lines
Checkpatch emits WARNING: quoted string split across lines. To keep the code clean and with the 80 column length indentation the check and registration code for
kmsg_dump_registerhas been transferred to a new functionhv_kmsg_dump_register.Signed-off-by Matheus Castello <[email protected]>--- drivers/hv/vmbus_drv.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)drivers/hv/vmbus_drv.c +7
-0@@ -1387,6 +1387,23 @@ static struct kmsg_dumper hv_kmsg_dumper = { .dump = hv_kmsg_dump, }; +static void hv_kmsg_dump_register (void ) +{ +int ret; + + hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page (); +if (hv_panic_page) { + ret =kmsg_dump_register (&hv_kmsg_dumper);drivers/hv/vmbus_drv.c static struct kmsg_dumper hv_kmsg_dumper = { · line 1406
Quoted 10 lines
drivers/hv/vmbus_drv.c +10
-0+if (ret) { +pr_err ("Hyper-V: kmsg dump register error 0x%x\n" , ret); +hv_free_hyperv_page ((unsigned long )hv_panic_page); + hv_panic_page =NULL ; + } + }else { +pr_err ("Hyper-V: panic message page memory allocation failed" ); + } +} +The above would be marginally better if organized as follows so that the main execution path isn't in an "if" clause. Also reduces indentation.
Quoted 13 lines
hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page();
if (!hv_panic_page) {
pr_err("Hyper-V: panic message page memory allocation failed");
return;
}
ret = kmsg_dump_register(&hv_kmsg_dumper);
if (ret) {
pr_err("Hyper-V: kmsg dump register error 0x%x\n", ret);
hv_free_hyperv_page((unsigned long)hv_panic_page);
hv_panic_page = NULL;
}Thanks for the review, great I will use it on the v2.
Quoted 30 lines
Quoted 29 lines
drivers/hv/vmbus_drv.c +2
-16static struct ctl_table_header *hv_ctl_table_hdr;/* @@ -1477,21 +1494,8 @@ static int vmbus_bus_init(void)* capability is supported by the hypervisor. */ hv_get_crash_ctl (hyperv_crash_ctl); -if (hyperv_crash_ctl &HV_CRASH_CTL_CRASH_NOTIFY_MSG ) { - hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page (); -if (hv_panic_page) { - ret =kmsg_dump_register (&hv_kmsg_dumper); -if (ret) { -pr_err ("Hyper-V: kmsg dump register " -"error 0x%x\n" , ret); -hv_free_hyperv_page ( - (unsigned long )hv_panic_page); - hv_panic_page =NULL ; - } - }else -pr_err ("Hyper-V: panic message page memory " -"allocation failed" ); - } +if (hyperv_crash_ctl &HV_CRASH_CTL_CRASH_NOTIFY_MSG ) +hv_kmsg_dump_register ();register_die_notifier (&hyperv_die_block); } --2.28.0
Re: [PATCH 4/6] drivers: hv: vmbus: Fix checkpatch SPLIT_STRING
Quoted 1 line · Matheus Castello
Quoted 1 line
drivers/hv/vmbus_drv.c
Quoted 1 line
drivers/hv/vmbus_drv.c +0
-0
[]
Quoted 6 lines
Quoted 6 lines
The above would be marginally better if organized as follows so that the main execution path isn't in an "if" clause. Also reduces indentation.
hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page(); if (!hv_panic_page) { pr_err("Hyper-V: panic message page memory allocation failed");
And nicer to add a terminating newline to the format like the pr_err below.
Quoted 8 lines
Quoted 8 lines
return; } ret = kmsg_dump_register(&hv_kmsg_dumper); if (ret) { pr_err("Hyper-V: kmsg dump register error 0x%x\n", ret); hv_free_hyperv_page((unsigned long)hv_panic_page); hv_panic_page = NULL; }
Re: [PATCH 4/6] drivers: hv: vmbus: Fix checkpatch SPLIT_STRING
Em 11/24/2020 11:56 PM, Joe Perches escreveu:
Quoted 12 lines · Matheus Castello
Quoted 1 line
Quoted 1 line
drivers/hv/vmbus_drv.c
Quoted 1 line
drivers/hv/vmbus_drv.c +0
-0[]
Quoted 6 lines
Quoted 6 lines
The above would be marginally better if organized as follows so that the main execution path isn't in an "if" clause. Also reduces indentation.
hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page(); if (!hv_panic_page) { pr_err("Hyper-V: panic message page memory allocation failed");And nicer to add a terminating newline to the format like the
pr_errbelow.
Oops, sending v3. Thanks Joe Perches!
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
return; } ret = kmsg_dump_register(&hv_kmsg_dumper); if (ret) { pr_err("Hyper-V: kmsg dump register error 0x%x\n", ret); hv_free_hyperv_page((unsigned long)hv_panic_page); hv_panic_page = NULL; }
PATCH 5/6 drivers: hv: vmbus: Fix unnecessary OOM_MESSAGE
In reply to Matheus CastelloFixed checkpatch warning: Possible unnecessary 'out of memory' message checkpatch(OOM_MESSAGE)
--- drivers/hv/vmbus_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hv/vmbus_drv.c +1 -3
@@ -1989,10 +1989,8 @@ struct hv_device *vmbus_device_create(const guid_t *type,struct hv_device *child_device_obj; child_device_obj =kzalloc (sizeof (struct hv_device ),GFP_KERNEL ); -if (!child_device_obj) { -pr_err ("Unable to allocate device object for child device\n" ); +if (!child_device_obj)return NULL ; - } child_device_obj->channel = channel;guid_copy (&child_device_obj->dev_type, type);
--
2.28.0
Wei Liu
maintainerRe: [PATCH 5/6] drivers: hv: vmbus: Fix unnecessary OOM_MESSAGE
Quoted 13 lines · Matheus Castello
Fixed checkpatch warning: Possible unnecessary 'out of memory' message
checkpatch(OOM_MESSAGE)Signed-off-by Matheus Castello <[email protected]>--- drivers/hv/vmbus_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/hv/vmbus_drv.c +0
-0
drivers/hv/vmbus_drv.c struct hv_device *vmbus_device_create(const guid_t *type, · line 1992
Quoted 6 lines
drivers/hv/vmbus_drv.c +1
-2@@ -1989,10 +1989,8 @@ struct hv_device *vmbus_device_create(const guid_t *type,struct hv_device *child_device_obj; child_device_obj =kzalloc (sizeof (struct hv_device ),GFP_KERNEL ); -if (!child_device_obj) { -pr_err ("Unable to allocate device object for child device\n" ); +if (!child_device_obj)
The generic OOM message would give you a stack dump but not as specific / clear as the message you deleted.
Also, the original intent of this check was to check for things like
printk("Out of memory");which was clearly redundant. The message we print here is not that.
See https://lkml.org/lkml/2014/6/10/382 .
Wei.
Quoted 8 lines
drivers/hv/vmbus_drv.c +0
-2return NULL ; - } child_device_obj->channel = channel;guid_copy (&child_device_obj->dev_type, type); --2.28.0
Wei Liu
maintainerRe: [PATCH 5/6] drivers: hv: vmbus: Fix unnecessary OOM_MESSAGE
Quoted 24 lines · Wei Liu
Quoted 13 lines · Matheus Castello
Fixed checkpatch warning: Possible unnecessary 'out of memory' message
checkpatch(OOM_MESSAGE)Signed-off-by Matheus Castello <[email protected]>--- drivers/hv/vmbus_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/hv/vmbus_drv.c +0
-0drivers/hv/vmbus_drv.c struct hv_device *vmbus_device_create(const guid_t *type, · line 1992
Quoted 6 lines
drivers/hv/vmbus_drv.c +1
-2@@ -1989,10 +1989,8 @@ struct hv_device *vmbus_device_create(const guid_t *type,struct hv_device *child_device_obj; child_device_obj =kzalloc (sizeof (struct hv_device ),GFP_KERNEL ); -if (!child_device_obj) { -pr_err ("Unable to allocate device object for child device\n" ); +if (!child_device_obj)The generic OOM message would give you a stack dump but not as specific / clear as the message you deleted.
Quoted 8 lines
Also, the original intent of this check was to check for things like
printk("Out of memory");which was clearly redundant. The message we print here is not that.
In case my message is not clear, I think this pr_err should stay. ;-)
Wei.
PATCH 6/6 drivers: hv: vmbus: Fix call msleep using < 20ms
In reply to Matheus CastelloFixed checkpatch warning: MSLEEP: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst
--- drivers/hv/vmbus_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hv/vmbus_drv.c +1 -1
@@ -2382,7 +2382,7 @@ static int vmbus_bus_suspend(struct device *dev)* We wait here until the completion of any channel * offers that are currently in progress. */ -msleep (1 ); +usleep_range (1000 ,2000 ); }mutex_lock (&vmbus_connection.channel_mutex);
--
2.28.0
RE: [PATCH 6/6] drivers: hv: vmbus: Fix call msleep using < 20ms
From: Matheus Castello <[email protected]> Sent: Sunday, November 15, 2020 11:58 AM
Quoted 23 lines
Fixed checkpatch warning: MSLEEP: msleep < 20ms can sleep for up to 20ms; see
Documentation/timers/timers-howto.rstSigned-off-by Matheus Castello <[email protected]>--- drivers/hv/vmbus_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hv/vmbus_drv.c +1
-2@@ -2382,7 +2382,7 @@ static int vmbus_bus_suspend(struct device *dev)* We wait here until the completion of any channel * offers that are currently in progress. */ -msleep (1 ); +usleep_range (1000 ,2000 ); }mutex_lock (&vmbus_connection.channel_mutex); --
Quoted 1 line
2.28.0
Wei Liu
maintainerQuoted 11 lines · Matheus Castello
This series fixes some warnings edmited by the checkpatch in the file
vmbus_drv.c. I thought it would be good to split each fix into a commit to help with the review.Matheus Castello (6):
drivers: hv: Fixhyperv_record_panic_msgpath on comment
drivers: hv: vmbus: Replace symbolic permissions by octal permissions
drivers: hv: vmbus: Fix checkpatchLINE_SPACING
drivers: hv: vmbus: Fix checkpatchSPLIT_STRING
drivers: hv: vmbus: Fix unnecessaryOOM_MESSAGE
drivers: hv: vmbus: Fix call msleep using < 20ms
I've pushed patch 1-3 and 6 to hyperv-next.
Patch 4 has a pending comment from Michael. Patch 5 can be dropped.
Wei.
Hi Wei,
Em 11/17/2020 7:58 AM, Wei Liu escreveu:
Quoted 13 lines · Matheus Castello
Quoted 11 lines
This series fixes some warnings edmited by the checkpatch in the file
vmbus_drv.c. I thought it would be good to split each fix into a commit to help with the review.Matheus Castello (6):
drivers: hv: Fixhyperv_record_panic_msgpath on comment
drivers: hv: vmbus: Replace symbolic permissions by octal permissions
drivers: hv: vmbus: Fix checkpatchLINE_SPACING
drivers: hv: vmbus: Fix checkpatchSPLIT_STRING
drivers: hv: vmbus: Fix unnecessaryOOM_MESSAGE
drivers: hv: vmbus: Fix call msleep using < 20ms
Quoted 4 lines
I've pushed patch 1-3 and 6 to hyperv-next.
Patch 4 has a pending comment from Michael. Patch 5 can be dropped.
Thanks for the review, got it and I agree with the drop of patch 5 thanks to point it. I will send the v2 for the patch 4.
Quoted 2 lines
Wei.