All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mugunthan V N <mugunthanvnm@ti.com>
To: Jan Luebbe <jlu@pengutronix.de>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Vaibhav Hiremath <hvaibhav@ti.com>,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/3] net: cpsw: verify correct number of slaves in DT
Date: Mon, 3 Dec 2012 22:30:18 +0530	[thread overview]
Message-ID: <50BCDAA2.5020308@ti.com> (raw)
In-Reply-To: <1354542569-6165-2-git-send-email-jlu@pengutronix.de>

On 12/3/2012 7:19 PM, Jan Luebbe wrote:
> Check that the number of available slaves passed from DT matches the
> value of the "slaves" property in the cpsw node. Otherwise, priv->slaves
> would be the wrong size.
>
> Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
> ---
>   drivers/net/ethernet/ti/cpsw.c |   17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
>
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index c0e676a..8de3e92 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -832,6 +832,16 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
>   		const char *phy_id = NULL;
>   		const void *mac_addr = NULL;
>   
> +		if (!of_device_is_available(slave_node))
> +			continue;
> +
> +		if (i >= data->slaves) {
> +			dev_err(&pdev->dev, "Too many slaves in the DT (> %d).\n",
> +				data->slaves);
> +			ret = -EINVAL;
> +			goto error_ret;
> +		}
> +
>   		if (of_property_read_string(slave_node, "phy_id", &phy_id)) {
>   			dev_err(&pdev->dev, "Missing slave[%d] phy_id property.\n", i);
>   			ret = -EINVAL;
> @@ -861,6 +871,13 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
>   		i++;
>   	}
>   
> +	if (i < data->slaves) {
> +		dev_err(&pdev->dev, "Not enough slaves in the DT (< %d).\n",
> +			data->slaves);
> +		ret = -EINVAL;
> +		goto error_ret;
> +	}
> +
>   	/*
>   	 * Populate all the child nodes here...
>   	 */

The patches look good to me.

Acked-by: Mugunthan V N<mugunthanvnm@ti.com>

Regards
Mugunthan V N


WARNING: multiple messages have this Message-ID (diff)
From: mugunthanvnm@ti.com (Mugunthan V N)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] net: cpsw: verify correct number of slaves in DT
Date: Mon, 3 Dec 2012 22:30:18 +0530	[thread overview]
Message-ID: <50BCDAA2.5020308@ti.com> (raw)
In-Reply-To: <1354542569-6165-2-git-send-email-jlu@pengutronix.de>

On 12/3/2012 7:19 PM, Jan Luebbe wrote:
> Check that the number of available slaves passed from DT matches the
> value of the "slaves" property in the cpsw node. Otherwise, priv->slaves
> would be the wrong size.
>
> Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
> ---
>   drivers/net/ethernet/ti/cpsw.c |   17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
>
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index c0e676a..8de3e92 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -832,6 +832,16 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
>   		const char *phy_id = NULL;
>   		const void *mac_addr = NULL;
>   
> +		if (!of_device_is_available(slave_node))
> +			continue;
> +
> +		if (i >= data->slaves) {
> +			dev_err(&pdev->dev, "Too many slaves in the DT (> %d).\n",
> +				data->slaves);
> +			ret = -EINVAL;
> +			goto error_ret;
> +		}
> +
>   		if (of_property_read_string(slave_node, "phy_id", &phy_id)) {
>   			dev_err(&pdev->dev, "Missing slave[%d] phy_id property.\n", i);
>   			ret = -EINVAL;
> @@ -861,6 +871,13 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
>   		i++;
>   	}
>   
> +	if (i < data->slaves) {
> +		dev_err(&pdev->dev, "Not enough slaves in the DT (< %d).\n",
> +			data->slaves);
> +		ret = -EINVAL;
> +		goto error_ret;
> +	}
> +
>   	/*
>   	 * Populate all the child nodes here...
>   	 */

The patches look good to me.

Acked-by: Mugunthan V N<mugunthanvnm@ti.com>

Regards
Mugunthan V N

WARNING: multiple messages have this Message-ID (diff)
From: Mugunthan V N <mugunthanvnm@ti.com>
To: Jan Luebbe <jlu@pengutronix.de>
Cc: <netdev@vger.kernel.org>, "David S. Miller" <davem@davemloft.net>,
	Vaibhav Hiremath <hvaibhav@ti.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-omap@vger.kernel.org>
Subject: Re: [PATCH 2/3] net: cpsw: verify correct number of slaves in DT
Date: Mon, 3 Dec 2012 22:30:18 +0530	[thread overview]
Message-ID: <50BCDAA2.5020308@ti.com> (raw)
In-Reply-To: <1354542569-6165-2-git-send-email-jlu@pengutronix.de>

On 12/3/2012 7:19 PM, Jan Luebbe wrote:
> Check that the number of available slaves passed from DT matches the
> value of the "slaves" property in the cpsw node. Otherwise, priv->slaves
> would be the wrong size.
>
> Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
> ---
>   drivers/net/ethernet/ti/cpsw.c |   17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
>
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index c0e676a..8de3e92 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -832,6 +832,16 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
>   		const char *phy_id = NULL;
>   		const void *mac_addr = NULL;
>   
> +		if (!of_device_is_available(slave_node))
> +			continue;
> +
> +		if (i >= data->slaves) {
> +			dev_err(&pdev->dev, "Too many slaves in the DT (> %d).\n",
> +				data->slaves);
> +			ret = -EINVAL;
> +			goto error_ret;
> +		}
> +
>   		if (of_property_read_string(slave_node, "phy_id", &phy_id)) {
>   			dev_err(&pdev->dev, "Missing slave[%d] phy_id property.\n", i);
>   			ret = -EINVAL;
> @@ -861,6 +871,13 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
>   		i++;
>   	}
>   
> +	if (i < data->slaves) {
> +		dev_err(&pdev->dev, "Not enough slaves in the DT (< %d).\n",
> +			data->slaves);
> +		ret = -EINVAL;
> +		goto error_ret;
> +	}
> +
>   	/*
>   	 * Populate all the child nodes here...
>   	 */

The patches look good to me.

Acked-by: Mugunthan V N<mugunthanvnm@ti.com>

Regards
Mugunthan V N


  reply	other threads:[~2012-12-03 17:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-03 13:49 [PATCH 1/3] net: cpsw: replace pr_xxx with dev_xxx functions Jan Luebbe
2012-12-03 13:49 ` Jan Luebbe
2012-12-03 13:49 ` [PATCH 2/3] net: cpsw: verify correct number of slaves in DT Jan Luebbe
2012-12-03 13:49   ` Jan Luebbe
2012-12-03 17:00   ` Mugunthan V N [this message]
2012-12-03 17:00     ` Mugunthan V N
2012-12-03 17:00     ` Mugunthan V N
2012-12-03 13:49 ` [PATCH 3/3] net: cpsw: implement ioctl for MII Jan Luebbe
2012-12-03 13:49   ` Jan Luebbe
2012-12-03 14:16   ` Ben Hutchings
2012-12-03 14:16     ` Ben Hutchings
2012-12-03 14:16     ` Ben Hutchings
2012-12-03 17:04   ` Mugunthan V N
2012-12-03 17:04     ` Mugunthan V N
2012-12-03 17:04     ` Mugunthan V N
2012-12-04 11:06     ` Jan Lübbe
2012-12-04 11:06       ` Jan Lübbe
2012-12-03 16:59 ` [PATCH 1/3] net: cpsw: replace pr_xxx with dev_xxx functions Mugunthan V N
2012-12-03 16:59   ` Mugunthan V N
2012-12-03 16:59   ` Mugunthan V N

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50BCDAA2.5020308@ti.com \
    --to=mugunthanvnm@ti.com \
    --cc=davem@davemloft.net \
    --cc=hvaibhav@ti.com \
    --cc=jlu@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.