staging: unisys: uislib: uislib.c: sparse warning of context imbalance
PATCH 1/1 staging: unisys: uislib: uislib.c: sparse warning of context imbalance
fixed sparse warning : context imbalance in 'pause_device'
unexpected unlock
this patch will generate warning from checkpatch for lines over 80 character , but since those are user-visible strings so it was not modified.
---
hi , can you please review the patch and see if the approach is correct. The functiion is still doing the same what it was doing , only the logic is changed. if the approach is ok, then i can send a patch to fix the other two similar warning in the file.
drivers/staging/unisys/uislib/uislib.c | 82 ++++++++++++++++------------------ 1 file changed, 39 insertions(+), 43 deletions(-)
drivers/staging/unisys/uislib/uislib.c +39 -43
@@ -548,6 +548,7 @@ pause_device(CONTROLVM_MESSAGE *msg)struct bus_info *bus;struct device_info *dev;struct guest_msgs cmd; +int retval =CONTROLVM_RESP_SUCCESS ; busNo = msg->cmd.deviceChangeState.busNo; devNo = msg->cmd.deviceChangeState.devNo;
@@ -559,58 +560,53 @@ pause_device(CONTROLVM_MESSAGE *msg)if (devNo >= bus->deviceCount) {LOGERR ("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device(%d) >= deviceCount(%d)." , devNo, bus->deviceCount); -read_unlock (&BusListLock); -return CONTROLVM_RESP_ERROR_DEVICE_INVALID ; - } -/* make sure this device exists */ - dev = bus->device[devNo]; -if (!dev) { -LOGERR ("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device %d does not exist." , - devNo); -read_unlock (&BusListLock); -return CONTROLVM_RESP_ERROR_ALREADY_DONE ; - } -read_unlock (&BusListLock); -/* the msg is bound for virtpci; send -* guest_msgs struct to callback -*/ -if (!uuid_le_cmp (dev->channelTypeGuid, - UltraVhbaChannelProtocolGuid)) { - cmd.msgtype =GUEST_PAUSE_VHBA ; - cmd.pause_vhba.chanptr = dev->chanptr; - }else -if (!uuid_le_cmp (dev->channelTypeGuid, - UltraVnicChannelProtocolGuid)) { - cmd.msgtype =GUEST_PAUSE_VNIC ; - cmd.pause_vnic.chanptr = dev->chanptr; + retval =CONTROLVM_RESP_ERROR_DEVICE_INVALID ; }else { -LOGERR ("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: unknown channelTypeGuid.\n" ); -return -CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN ; - } - -if (!VirtControlChanFunc) { -LOGERR ("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered." ); -return -CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE ; - } - -if (!VirtControlChanFunc (&cmd)) { -LOGERR ("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: virtpci GUEST_PAUSE_[VHBA||VNIC] returned error." ); -return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR ; +/* make sure this device exists */ + dev = bus->device[devNo]; +if (!dev) { +LOGERR ("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device %d does not exist." , + devNo); + retval = +CONTROLVM_RESP_ERROR_ALREADY_DONE ; + } }break ; } } -if (!bus) {LOGERR ("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: bus %d does not exist" , busNo); -read_unlock (&BusListLock); -return CONTROLVM_RESP_ERROR_BUS_INVALID ; + retval =CONTROLVM_RESP_ERROR_BUS_INVALID ; } - -return CONTROLVM_RESP_SUCCESS ; +read_unlock (&BusListLock); +if (retval ==CONTROLVM_RESP_SUCCESS ) { +/* the msg is bound for virtpci; send +* guest_msgs struct to callback +*/ +if (!uuid_le_cmp (dev->channelTypeGuid, + UltraVhbaChannelProtocolGuid)) { + cmd.msgtype =GUEST_PAUSE_VHBA ; + cmd.pause_vhba.chanptr = dev->chanptr; + }else if (!uuid_le_cmp (dev->channelTypeGuid, + UltraVnicChannelProtocolGuid)) { + cmd.msgtype =GUEST_PAUSE_VNIC ; + cmd.pause_vnic.chanptr = dev->chanptr; + }else { +LOGERR ("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: unknown channelTypeGuid.\n" ); +return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN ; + } +if (!VirtControlChanFunc) { +LOGERR ("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered." ); +return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE ; + } +if (!VirtControlChanFunc (&cmd)) { +LOGERR ("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: virtpci GUEST_PAUSE_[VHBA||VNIC] returned error." ); +return +CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR ; + } + } +return retval; } static int
Signature · 1 line
1.8.1.2
Quoted 6 lines · Sudip Mukherjee
fixed sparse warning : context imbalance in '
pause_device'
unexpected unlock
this patch will generate warning from checkpatch for lines over 80 character , but since those are user-visible strings so it was not modified.
Quoted 7 lines
Signed-off-by Sudip Mukherjee <[email protected]>---
hi , can you please review the patch and see if the approach is correct. The functiion is still doing the same what it was doing , only the logic is changed. if the approach is ok, then i can send a patch to fix the other two similar warning in the file.
Hi Sudip,
I was able to successfully build and test your patch. The changes look good to me too, so I think we should take this patch. :)
Thanks!
-- Ben
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 15 lines · Benjamin M
Quoted 6 lines · Sudip Mukherjee
fixed sparse warning : context imbalance in '
pause_device'
unexpected unlock
this patch will generate warning from checkpatch for lines over 80 character , but since those are user-visible strings so it was not modified.Quoted 7 lines
Signed-off-by Sudip Mukherjee <[email protected]>---
hi , can you please review the patch and see if the approach is correct. The functiion is still doing the same what it was doing , only the logic is changed. if the approach is ok, then i can send a patch to fix the other two similar warning in the file.
Quoted 8 lines
Hi Sudip,
I was able to successfully build and test your patch. The changes look good to me too, so I think we should take this patch. :)
Thanks!
-- Ben
Hi Ben,
thanks. the same file is having two more similar warnings. if you want i can resend a patch fixing all the three warnings , or i can send two separate patches.
I personally will prefer two separate patches , as that will be easier for you to test and review.
thanks
sudip
Quoted 2 lines
Signed-off-by Benjamin Romer <[email protected]>Tested-by Benjamin Romer <[email protected]>
Quoted 9 lines · Sudip Mukherjee
Hi Ben,
thanks. the same file is having two more similar warnings. if you want i can resend a patch fixing all the three warnings , or i can send two separate patches.
I personally will prefer two separate patches , as that will be easier for you to test and review.thanks
sudip
That would be perfect, thanks. :)
-- Ben ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 8 lines · Benjamin M
Quoted 7 lines · Sudip Mukherjee
Hi Ben,
thanks. the same file is having two more similar warnings. if you want i can resend a patch fixing all the three warnings , or i can send two separate patches.
I personally will prefer two separate patches , as that will be easier for you to test and review.
Quoted 6 lines
Quoted 2 lines
thanks
sudipThat would be perfect, thanks. :)
-- Ben
Hi Ben,
sorry to disturb you again. i got confused , which one is perfect one combined patch or separate patches?
thanks
sudip
Quoted 6 lines · Sudip Mukherjee
Hi Ben,
sorry to disturb you again. i got confused , which one is perfect one combined patch or separate patches?thanks
sudip
Two patches, as you preferred.
-- Ben
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 5 lines · Benjamin M
Quoted 4 lines · Sudip Mukherjee
Hi Ben,
sorry to disturb you again. i got confused , which one is perfect one combined patch or separate patches?
Quoted 8 lines
Quoted 2 lines
thanks
sudipTwo patches, as you preferred.
-- Ben
ok. and if you get time can you please also have a look at :
[PATCH v4] staging: unisys: uislib: uisqueue.c: rewrite of do_locked_client_insert Dan Carpenter has already reviwed it.
thanks
sudip
Quoted 15 lines · Benjamin M
Quoted 6 lines · Sudip Mukherjee
fixed sparse warning : context imbalance in '
pause_device'
unexpected unlock
this patch will generate warning from checkpatch for lines over 80 character , but since those are user-visible strings so it was not modified.Quoted 7 lines
Signed-off-by Sudip Mukherjee <[email protected]>---
hi , can you please review the patch and see if the approach is correct. The functiion is still doing the same what it was doing , only the logic is changed. if the approach is ok, then i can send a patch to fix the other two similar warning in the file.
Quoted 4 lines
Hi Sudip,
I was able to successfully build and test your patch. The changes look good to me too, so I think we should take this patch. :)
Traditionally, you would respond with a:
so I can add it to the patch.
Care to do that here?
thanks,
greg k-h
Romer, Benjamin M
Acked-byQuoted 9 lines · Greg Kroah-Hartman
Traditionally, you would respond with a:
Acked-by Developer Name <email@address>so I can add it to the patch.
Care to do that here?
thanks,
greg k-h
Of course. :)
Should I do this instead of Tested-by and Signed-off-by, in the future?
-- Ben ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Greg Kroah-Hartman
maintainerQuoted 9 lines · Benjamin M
Quoted 8 lines · Greg Kroah-Hartman
Traditionally, you would respond with a:
Acked-by Developer Name <email@address>so I can add it to the patch.
Care to do that here?
thanks,
Quoted 7 lines
Quoted 1 line
greg k-h
Of course. :)
Acked-by Benjamin Romer <[email protected]>Should I do this instead of Tested-by and Signed-off-by, in the future?
If you test it, do a tested-by.
If you sign off on it (i.e. it flows through you to me), then a signed-off is correct.
Hope this helps,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
If you test it, do a tested-by.
If you sign off on it (i.e. it flows through you to me), then a signed-off is correct.
Hope this helps,
greg k-h
It does. :) We should add the Tested-by then, too.
-- Ben
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�