diff mbox series

device: Return error when ConnectProfile DBus method fails (second fix)

Message ID 20200426210247.757-1-pali@kernel.org (mailing list archive)
State New, archived
Headers show
Series device: Return error when ConnectProfile DBus method fails (second fix) | expand

Commit Message

Pali Rohár April 26, 2020, 9:02 p.m. UTC
This is fixup of commit 3aa815a31017e8793b030b04ef704ce85455b9aa. There is
another place which needs to distinguish between Connect and ConnectProfile
DBus method.
---
 src/device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com April 26, 2020, 9:06 p.m. UTC | #1
This is automated email and please do not replay to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While we are preparing for reviewing the patches, we found the following
issue/warning.


Test Result:
Checkpatch Failed

Patch Title:
device: Return error when ConnectProfile DBus method fails (second fix)

Output:
ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 3aa815a31017 ("device: Return error when ConnectProfile DBus method fails")'
#7: 
This is fixup of commit 3aa815a31017e8793b030b04ef704ce85455b9aa. There is

- total: 1 errors, 0 warnings, 10 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPLIT_STRING

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.



For more details about BlueZ coding style guide, please find it
in doc/coding-style.txt

---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz April 27, 2020, 4:44 p.m. UTC | #2
Hi Pali,

On Sun, Apr 26, 2020 at 2:05 PM Pali Rohár <pali@kernel.org> wrote:
>
> This is fixup of commit 3aa815a31017e8793b030b04ef704ce85455b9aa. There is
> another place which needs to distinguish between Connect and ConnectProfile
> DBus method.
> ---
>  src/device.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/device.c b/src/device.c
> index 229579378..7b0eb256e 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -1861,7 +1861,9 @@ static DBusMessage *connect_profiles(struct btd_device *dev, uint8_t bdaddr_type
>         dev->pending = create_pending_list(dev, uuid);
>         if (!dev->pending) {
>                 if (dev->svc_refreshed) {
> -                       if (find_service_with_state(dev->services,
> +                       if (dbus_message_is_method_call(msg, DEVICE_INTERFACE,
> +                                                       "Connect") &&
> +                               find_service_with_state(dev->services,
>                                                 BTD_SERVICE_STATE_CONNECTED))

Perhaps it would be better to have a helper function that checks this for us.

>                                 return dbus_message_new_method_return(msg);
>                         else
> --
> 2.20.1
>
Pali Rohár April 27, 2020, 6:14 p.m. UTC | #3
On Monday 27 April 2020 09:44:50 Luiz Augusto von Dentz wrote:
> Hi Pali,
> 
> On Sun, Apr 26, 2020 at 2:05 PM Pali Rohár <pali@kernel.org> wrote:
> >
> > This is fixup of commit 3aa815a31017e8793b030b04ef704ce85455b9aa. There is
> > another place which needs to distinguish between Connect and ConnectProfile
> > DBus method.
> > ---
> >  src/device.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/device.c b/src/device.c
> > index 229579378..7b0eb256e 100644
> > --- a/src/device.c
> > +++ b/src/device.c
> > @@ -1861,7 +1861,9 @@ static DBusMessage *connect_profiles(struct btd_device *dev, uint8_t bdaddr_type
> >         dev->pending = create_pending_list(dev, uuid);
> >         if (!dev->pending) {
> >                 if (dev->svc_refreshed) {
> > -                       if (find_service_with_state(dev->services,
> > +                       if (dbus_message_is_method_call(msg, DEVICE_INTERFACE,
> > +                                                       "Connect") &&
> > +                               find_service_with_state(dev->services,
> >                                                 BTD_SERVICE_STATE_CONNECTED))
> 
> Perhaps it would be better to have a helper function that checks this for us.

I do not know if it helps, but I think this is the last problem which I
observed with connect/disconnect profile method.

> >                                 return dbus_message_new_method_return(msg);
> >                         else
> > --
> > 2.20.1
> >
> 
> 
> -- 
> Luiz Augusto von Dentz
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index 229579378..7b0eb256e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1861,7 +1861,9 @@  static DBusMessage *connect_profiles(struct btd_device *dev, uint8_t bdaddr_type
 	dev->pending = create_pending_list(dev, uuid);
 	if (!dev->pending) {
 		if (dev->svc_refreshed) {
-			if (find_service_with_state(dev->services,
+			if (dbus_message_is_method_call(msg, DEVICE_INTERFACE,
+							"Connect") &&
+				find_service_with_state(dev->services,
 						BTD_SERVICE_STATE_CONNECTED))
 				return dbus_message_new_method_return(msg);
 			else