* [PATCH v2] NFC: nxp-nci: remove unnecessary labels
@ 2021-06-18 9:10 samirweng1979
2021-06-18 19:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: samirweng1979 @ 2021-06-18 9:10 UTC (permalink / raw)
To: charles.gorand, krzysztof.kozlowski; +Cc: netdev, linux-kernel, wengjianfeng
From: wengjianfeng <wengjianfeng@yulong.com>
Simplify the code by removing unnecessary labels and returning directly.
Signed-off-by: wengjianfeng <wengjianfeng@yulong.com>
---
drivers/nfc/nxp-nci/core.c | 39 +++++++++++++--------------------------
1 file changed, 13 insertions(+), 26 deletions(-)
diff --git a/drivers/nfc/nxp-nci/core.c b/drivers/nfc/nxp-nci/core.c
index a0ce95a..2b0c723 100644
--- a/drivers/nfc/nxp-nci/core.c
+++ b/drivers/nfc/nxp-nci/core.c
@@ -70,21 +70,16 @@ static int nxp_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
struct nxp_nci_info *info = nci_get_drvdata(ndev);
int r;
- if (!info->phy_ops->write) {
- r = -ENOTSUPP;
- goto send_exit;
- }
+ if (!info->phy_ops->write)
+ return -EOPNOTSUPP;
- if (info->mode != NXP_NCI_MODE_NCI) {
- r = -EINVAL;
- goto send_exit;
- }
+ if (info->mode != NXP_NCI_MODE_NCI)
+ return -EINVAL;
r = info->phy_ops->write(info->phy_id, skb);
if (r < 0)
kfree_skb(skb);
-send_exit:
return r;
}
@@ -104,10 +99,8 @@ int nxp_nci_probe(void *phy_id, struct device *pdev,
int r;
info = devm_kzalloc(pdev, sizeof(struct nxp_nci_info), GFP_KERNEL);
- if (!info) {
- r = -ENOMEM;
- goto probe_exit;
- }
+ if (!info)
+ return -ENOMEM;
info->phy_id = phy_id;
info->pdev = pdev;
@@ -120,31 +113,25 @@ int nxp_nci_probe(void *phy_id, struct device *pdev,
if (info->phy_ops->set_mode) {
r = info->phy_ops->set_mode(info->phy_id, NXP_NCI_MODE_COLD);
if (r < 0)
- goto probe_exit;
+ return r;
}
info->mode = NXP_NCI_MODE_COLD;
info->ndev = nci_allocate_device(&nxp_nci_ops, NXP_NCI_NFC_PROTOCOLS,
NXP_NCI_HDR_LEN, 0);
- if (!info->ndev) {
- r = -ENOMEM;
- goto probe_exit;
- }
+ if (!info->ndev)
+ return -ENOMEM;
nci_set_parent_dev(info->ndev, pdev);
nci_set_drvdata(info->ndev, info);
r = nci_register_device(info->ndev);
- if (r < 0)
- goto probe_exit_free_nci;
+ if (r < 0) {
+ nci_free_device(info->ndev);
+ return r;
+ }
*ndev = info->ndev;
-
- goto probe_exit;
-
-probe_exit_free_nci:
- nci_free_device(info->ndev);
-probe_exit:
return r;
}
EXPORT_SYMBOL(nxp_nci_probe);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] NFC: nxp-nci: remove unnecessary labels
2021-06-18 9:10 [PATCH v2] NFC: nxp-nci: remove unnecessary labels samirweng1979
@ 2021-06-18 19:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-18 19:20 UTC (permalink / raw)
To: samirweng1979
Cc: charles.gorand, krzysztof.kozlowski, netdev, linux-kernel, wengjianfeng
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Fri, 18 Jun 2021 17:10:16 +0800 you wrote:
> From: wengjianfeng <wengjianfeng@yulong.com>
>
> Simplify the code by removing unnecessary labels and returning directly.
>
> Signed-off-by: wengjianfeng <wengjianfeng@yulong.com>
> ---
> drivers/nfc/nxp-nci/core.c | 39 +++++++++++++--------------------------
> 1 file changed, 13 insertions(+), 26 deletions(-)
Here is the summary with links:
- [v2] NFC: nxp-nci: remove unnecessary labels
https://git.kernel.org/netdev/net-next/c/96a19319921c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-18 19:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 9:10 [PATCH v2] NFC: nxp-nci: remove unnecessary labels samirweng1979
2021-06-18 19:20 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.