linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/bluetooth: remove unneeded err variable
@ 2022-01-18  7:50 cgel.zte
  2022-01-19 19:33 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: cgel.zte @ 2022-01-18  7:50 UTC (permalink / raw)
  To: marcel
  Cc: johan.hedberg, luiz.dentz, davem, kuba, linux-bluetooth, netdev,
	linux-kernel, Minghao Chi, Zeal Robot, CGEL ZTE

From: Minghao Chi <chi.minghao@zte.com.cn>

Return value from mgmt_cmd_complete() directly instead
of taking this in another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
---
 net/bluetooth/mgmt.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 37087cf7dc5a..d0804648da32 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -8601,7 +8601,6 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
 	struct mgmt_cp_get_adv_size_info *cp = data;
 	struct mgmt_rp_get_adv_size_info rp;
 	u32 flags, supported_flags;
-	int err;
 
 	bt_dev_dbg(hdev, "sock %p", sk);
 
@@ -8628,10 +8627,8 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
 	rp.max_adv_data_len = tlv_data_max_len(hdev, flags, true);
 	rp.max_scan_rsp_len = tlv_data_max_len(hdev, flags, false);
 
-	err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
+	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
 				MGMT_STATUS_SUCCESS, &rp, sizeof(rp));
-
-	return err;
 }
 
 static const struct hci_mgmt_handler mgmt_handlers[] = {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/bluetooth: remove unneeded err variable
  2022-01-18  7:50 [PATCH] net/bluetooth: remove unneeded err variable cgel.zte
@ 2022-01-19 19:33 ` Marcel Holtmann
  2022-02-01 20:36   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2022-01-19 19:33 UTC (permalink / raw)
  To: cgel.zte
  Cc: Johan Hedberg, Luiz Augusto von Dentz, David S. Miller,
	Jakub Kicinski, linux-bluetooth, open list:NETWORKING [GENERAL],
	Linux Kernel Mailing List, Minghao Chi, Zeal Robot

Hi Minghao,

> Return value from mgmt_cmd_complete() directly instead
> of taking this in another redundant variable.

the Bluetooth subsystem uses Bluetooth: as subject prefix.

> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
> ---
> net/bluetooth/mgmt.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 37087cf7dc5a..d0804648da32 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -8601,7 +8601,6 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
> 	struct mgmt_cp_get_adv_size_info *cp = data;
> 	struct mgmt_rp_get_adv_size_info rp;
> 	u32 flags, supported_flags;
> -	int err;
> 
> 	bt_dev_dbg(hdev, "sock %p", sk);
> 
> @@ -8628,10 +8627,8 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
> 	rp.max_adv_data_len = tlv_data_max_len(hdev, flags, true);
> 	rp.max_scan_rsp_len = tlv_data_max_len(hdev, flags, false);
> 
> -	err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
> +	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
> 				MGMT_STATUS_SUCCESS, &rp, sizeof(rp));
> -
> -	return err;
> }

You also have a coding style error here in your indentation.

Regards

Marcel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/bluetooth: remove unneeded err variable
  2022-01-19 19:33 ` Marcel Holtmann
@ 2022-02-01 20:36   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-02-01 20:36 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: cgel.zte, Johan Hedberg, David S. Miller, Jakub Kicinski,
	linux-bluetooth, open list:NETWORKING [GENERAL],
	Linux Kernel Mailing List, Minghao Chi, Zeal Robot

Hi,

On Wed, Jan 19, 2022 at 11:34 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Minghao,
>
> > Return value from mgmt_cmd_complete() directly instead
> > of taking this in another redundant variable.
>
> the Bluetooth subsystem uses Bluetooth: as subject prefix.
>
> > Reported-by: Zeal Robot <zealci@zte.com.cn>
> > Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> > Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
> > ---
> > net/bluetooth/mgmt.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> > index 37087cf7dc5a..d0804648da32 100644
> > --- a/net/bluetooth/mgmt.c
> > +++ b/net/bluetooth/mgmt.c
> > @@ -8601,7 +8601,6 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
> >       struct mgmt_cp_get_adv_size_info *cp = data;
> >       struct mgmt_rp_get_adv_size_info rp;
> >       u32 flags, supported_flags;
> > -     int err;
> >
> >       bt_dev_dbg(hdev, "sock %p", sk);
> >
> > @@ -8628,10 +8627,8 @@ static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
> >       rp.max_adv_data_len = tlv_data_max_len(hdev, flags, true);
> >       rp.max_scan_rsp_len = tlv_data_max_len(hdev, flags, false);
> >
> > -     err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
> > +     return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_ADV_SIZE_INFO,
> >                               MGMT_STATUS_SUCCESS, &rp, sizeof(rp));
> > -
> > -     return err;
> > }
>
> You also have a coding style error here in your indentation.
>
> Regards
>
> Marcel

Applied, after fixing the coding style and commit message, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-01 20:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18  7:50 [PATCH] net/bluetooth: remove unneeded err variable cgel.zte
2022-01-19 19:33 ` Marcel Holtmann
2022-02-01 20:36   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).