-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: shell: Fix null check in cmd_conn_phy_update #34203
Conversation
Try to fix #34201 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other commands like data length update, connection update, etc... all have this issue. Its best to address them all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generally agree with @cvinayak regarding adding this everywhere, but I'm perfectly content to fix those in other PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The merge commits must be removed.
@kaiser-ren Btw, you can link this PR to the issue by using one of the Github closing keywords in the pull request description: https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword That way, when this is merged, the issue is automatically marked as done. |
Thanks. Apologize that this is my first zephyr pull request, it may take some time. |
Here is a CI error, Commit e8d025fca8: |
You can modify your commit message but doing either |
@kaiser-ren You should read up on the contributing guidelines for the project, that will help you get this PR ready. |
Thanks, fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also reduce the commits to just one commit.
@kaiser-ren The commit is empty. |
Apologize very deeply to make this PR mess, finally, make CI happy except buildkite is still ongoing. @Thalley, already merged the commit into one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks alright to me
subsys/bluetooth/shell/bt.c
Outdated
shell_error(shell, | ||
"%s: at least, one connection is required\n", | ||
shell->ctx->active_cmd.syntax); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation seems slight off, but not something I would block this PR for
subsys/bluetooth/shell/bt.c
Outdated
@@ -2141,6 +2141,13 @@ static int cmd_conn_phy_update(const struct shell *shell, size_t argc, | |||
struct bt_conn_le_phy_param param; | |||
int err; | |||
|
|||
if (default_conn == NULL) { | |||
shell_error(shell, | |||
"%s: at least, one connection is required\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
is redundant. shell_error
adds in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nordic-krch .
@nordic-krch and @Thalley , after this PR, I will create another PR to add the null check for conn_update() and conn_data_length_update(), how about I fix "\n" at the next PR and we keep this approval process going? Sound good to every approver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think that you can remove \n
in this PR, if there is no critical changes others reviewers don't need to re-review and approvals stays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @nordic-krch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger, I've already done it.
Null check in case of system failure. Signed-off-by: Kai Ren <renkaikaiser@163.com>
When I used ./tests/bluetooth/shell, if there is not any connections established but perform bt phy-update, it can cause a fatal error because of conn-check-missing, null check for default_conn pointer is necessary in case causing a system failure.
Fixes #34201