mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
NFC: nxp-nci: remove unnecessary labels
[ Upstream commit96a1931992] Simplify the code by removing unnecessary labels and returning directly. Signed-off-by: wengjianfeng <wengjianfeng@yulong.com> Signed-off-by: David S. Miller <davem@davemloft.net> Stable-dep-of:7bf1ed6aff("nfc: nxp-nci: Fix potential memory leak in nxp_nci_send()") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e8c11ee2d0
commit
eecea068bf
|
|
@ -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);
|
struct nxp_nci_info *info = nci_get_drvdata(ndev);
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!info->phy_ops->write) {
|
if (!info->phy_ops->write)
|
||||||
r = -ENOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
goto send_exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info->mode != NXP_NCI_MODE_NCI) {
|
if (info->mode != NXP_NCI_MODE_NCI)
|
||||||
r = -EINVAL;
|
return -EINVAL;
|
||||||
goto send_exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = info->phy_ops->write(info->phy_id, skb);
|
r = info->phy_ops->write(info->phy_id, skb);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
|
|
||||||
send_exit:
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,10 +99,8 @@ int nxp_nci_probe(void *phy_id, struct device *pdev,
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
info = devm_kzalloc(pdev, sizeof(struct nxp_nci_info), GFP_KERNEL);
|
info = devm_kzalloc(pdev, sizeof(struct nxp_nci_info), GFP_KERNEL);
|
||||||
if (!info) {
|
if (!info)
|
||||||
r = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto probe_exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->phy_id = phy_id;
|
info->phy_id = phy_id;
|
||||||
info->pdev = pdev;
|
info->pdev = pdev;
|
||||||
|
|
@ -120,31 +113,25 @@ int nxp_nci_probe(void *phy_id, struct device *pdev,
|
||||||
if (info->phy_ops->set_mode) {
|
if (info->phy_ops->set_mode) {
|
||||||
r = info->phy_ops->set_mode(info->phy_id, NXP_NCI_MODE_COLD);
|
r = info->phy_ops->set_mode(info->phy_id, NXP_NCI_MODE_COLD);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto probe_exit;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->mode = NXP_NCI_MODE_COLD;
|
info->mode = NXP_NCI_MODE_COLD;
|
||||||
|
|
||||||
info->ndev = nci_allocate_device(&nxp_nci_ops, NXP_NCI_NFC_PROTOCOLS,
|
info->ndev = nci_allocate_device(&nxp_nci_ops, NXP_NCI_NFC_PROTOCOLS,
|
||||||
NXP_NCI_HDR_LEN, 0);
|
NXP_NCI_HDR_LEN, 0);
|
||||||
if (!info->ndev) {
|
if (!info->ndev)
|
||||||
r = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto probe_exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
nci_set_parent_dev(info->ndev, pdev);
|
nci_set_parent_dev(info->ndev, pdev);
|
||||||
nci_set_drvdata(info->ndev, info);
|
nci_set_drvdata(info->ndev, info);
|
||||||
r = nci_register_device(info->ndev);
|
r = nci_register_device(info->ndev);
|
||||||
if (r < 0)
|
if (r < 0) {
|
||||||
goto probe_exit_free_nci;
|
nci_free_device(info->ndev);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
*ndev = info->ndev;
|
*ndev = info->ndev;
|
||||||
|
|
||||||
goto probe_exit;
|
|
||||||
|
|
||||||
probe_exit_free_nci:
|
|
||||||
nci_free_device(info->ndev);
|
|
||||||
probe_exit:
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(nxp_nci_probe);
|
EXPORT_SYMBOL(nxp_nci_probe);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user