Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1308819 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2016-01-13 22:30 +0100 |
| Last post | 2016-01-14 23:00 +0100 |
| Articles | 6 — 4 participants |
Back to article view | Back to linux.kernel
fsl/fman: Clarification for implementation details in dtsec_config() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-13 22:30 +0100
Re: fsl/fman: Clarification for implementation details in dtsec_config() Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-13 22:40 +0100
Re: fsl/fman: Clarification for implementation details in dtsec_config() Andrew Lunn <andrew@lunn.ch> - 2016-01-13 23:10 +0100
[PATCH] fsl/fman: Delete one function call "put_device" in dtsec_config() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-14 16:10 +0100
Re: [PATCH] fsl/fman: Delete one function call "put_device" in dtsec_config() Andrew Lunn <andrew@lunn.ch> - 2016-01-14 17:30 +0100
Re: [PATCH] fsl/fman: Delete one function call "put_device" in dtsec_config() David Miller <davem@davemloft.net> - 2016-01-14 23:00 +0100
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-01-13 22:30 +0100 |
| Subject | fsl/fman: Clarification for implementation details in dtsec_config() |
| Message-ID | <qQB9o-5uC-1@gated-at.bofh.it> |
Hello,
The Coccinelle semantic patch "deref_null.cocci" pointed out a potential
problem in the implementation of the function "dtsec_config" (lines 1434-1439):
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/drivers/net/ethernet/freescale/fman/fman_dtsec.c?id=e5a03bfd873c29eb786655ef2e95e53ed242b404#n1434
…
dtsec->tbiphy = of_phy_find_device(params->internal_phy_node);
if (!dtsec->tbiphy) {
pr_err("of_phy_find_device (TBI PHY) failed\n");
put_device(&dtsec->tbiphy->mdio.dev);
goto err_dtsec_drv_param;
}
…
If the pointer "dtsec->tbiphy" is NULL, then it will especially matter
if the shown address computation will succeed.
Should the call of the function "put_device" be removed,
or was another argument intended?
Regards,
Markus
[toc] | [next] | [standalone]
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2016-01-13 22:40 +0100 |
| Subject | Re: fsl/fman: Clarification for implementation details in dtsec_config() |
| Message-ID | <qQBj5-5yt-31@gated-at.bofh.it> |
| In reply to | #1308819 |
I think you can remove the put_device() line. regards, dan carpenter
[toc] | [prev] | [next] | [standalone]
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Date | 2016-01-13 23:10 +0100 |
| Subject | Re: fsl/fman: Clarification for implementation details in dtsec_config() |
| Message-ID | <qQBM6-5Z4-21@gated-at.bofh.it> |
| In reply to | #1308833 |
On Thu, Jan 14, 2016 at 12:35:37AM +0300, Dan Carpenter wrote: > I think you can remove the put_device() line. Agreed. of_phy_find_device() only does a get_device() when it finds a matching device. Andrew
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-01-14 16:10 +0100 |
| Subject | [PATCH] fsl/fman: Delete one function call "put_device" in dtsec_config() |
| Message-ID | <qQRHd-nE-47@gated-at.bofh.it> |
| In reply to | #1308856 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 14 Jan 2016 15:46:28 +0100
The Coccinelle semantic patch script "deref_null.cocci" pointed a problem
out in the implementation of the function "dtsec_config".
A null pointer was assigned to the data structure member "tbiphy" of the
variable "dtsec" if a matching device was not found.
A call of the function "put_device" was unnecessary then because
a previous call of the function "get_device" was not triggered.
Thus remove the function call "put_device" after the printing of the
desired error message.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/net/ethernet/freescale/fman/fman_dtsec.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
index 6b1261c..7c92eb8 100644
--- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
+++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
@@ -1434,7 +1434,6 @@ struct fman_mac *dtsec_config(struct fman_mac_params *params)
dtsec->tbiphy = of_phy_find_device(params->internal_phy_node);
if (!dtsec->tbiphy) {
pr_err("of_phy_find_device (TBI PHY) failed\n");
- put_device(&dtsec->tbiphy->mdio.dev);
goto err_dtsec_drv_param;
}
--
2.6.3
[toc] | [prev] | [next] | [standalone]
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Date | 2016-01-14 17:30 +0100 |
| Subject | Re: [PATCH] fsl/fman: Delete one function call "put_device" in dtsec_config() |
| Message-ID | <qQSWC-197-23@gated-at.bofh.it> |
| In reply to | #1309369 |
On Thu, Jan 14, 2016 at 04:00:46PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 14 Jan 2016 15:46:28 +0100
>
> The Coccinelle semantic patch script "deref_null.cocci" pointed a problem
> out in the implementation of the function "dtsec_config".
>
> A null pointer was assigned to the data structure member "tbiphy" of the
> variable "dtsec" if a matching device was not found.
> A call of the function "put_device" was unnecessary then because
> a previous call of the function "get_device" was not triggered.
> Thus remove the function call "put_device" after the printing of the
> desired error message.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Fixes: 57ba4c9b56d8 ("fsl/fman: Add FMan MAC support")
Reviewd-by: Andrew Lunn <andrew@lunn.ch>
Andrew
> ---
> drivers/net/ethernet/freescale/fman/fman_dtsec.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> index 6b1261c..7c92eb8 100644
> --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> @@ -1434,7 +1434,6 @@ struct fman_mac *dtsec_config(struct fman_mac_params *params)
> dtsec->tbiphy = of_phy_find_device(params->internal_phy_node);
> if (!dtsec->tbiphy) {
> pr_err("of_phy_find_device (TBI PHY) failed\n");
> - put_device(&dtsec->tbiphy->mdio.dev);
> goto err_dtsec_drv_param;
> }
>
> --
> 2.6.3
>
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-01-14 23:00 +0100 |
| Subject | Re: [PATCH] fsl/fman: Delete one function call "put_device" in dtsec_config() |
| Message-ID | <qQY5Y-4Io-13@gated-at.bofh.it> |
| In reply to | #1309369 |
From: SF Markus Elfring <elfring@users.sourceforge.net> Date: Thu, 14 Jan 2016 16:00:46 +0100 > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Thu, 14 Jan 2016 15:46:28 +0100 > > The Coccinelle semantic patch script "deref_null.cocci" pointed a problem > out in the implementation of the function "dtsec_config". > > A null pointer was assigned to the data structure member "tbiphy" of the > variable "dtsec" if a matching device was not found. > A call of the function "put_device" was unnecessary then because > a previous call of the function "get_device" was not triggered. > Thus remove the function call "put_device" after the printing of the > desired error message. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Applied, thanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web