kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Kishon Vijay Abraham I <kishon@ti.com>
Cc: Vinod Koul <vkoul@kernel.org>, <linux-phy@lists.infradead.org>,
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] phy: ti: gmii-sel: check of_get_address() for failure
Date: Wed, 15 Sep 2021 12:27:33 +0300	[thread overview]
Message-ID: <577c979d-647d-c0b9-0a0d-9ae5be47c2d4@ti.com> (raw)
In-Reply-To: <20210914110038.GB11657@kili>



On 14/09/2021 14:00, Dan Carpenter wrote:
> Smatch complains that if of_get_address() returns NULL, then "size"
> isn't initialized.  Also it would lead to an Oops.
> 
> Fixes: 7f78322cdd67 ("phy: ti: gmii-sel: retrieve ports number and base offset from dt")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   drivers/phy/ti/phy-gmii-sel.c | 2 ++
>   1 file changed, 2 insertions(+)

Thank you.
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

> 
> diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c
> index 5fd2e8a08bfc..d0ab69750c6b 100644
> --- a/drivers/phy/ti/phy-gmii-sel.c
> +++ b/drivers/phy/ti/phy-gmii-sel.c
> @@ -320,6 +320,8 @@ static int phy_gmii_sel_init_ports(struct phy_gmii_sel_priv *priv)
>   		u64 size;
>   
>   		offset = of_get_address(dev->of_node, 0, &size, NULL);
> +		if (!offset)
> +			return -EINVAL;
>   		priv->num_ports = size / sizeof(u32);
>   		if (!priv->num_ports)
>   			return -EINVAL;
> 

-- 
Best regards,
grygorii

  reply	other threads:[~2021-09-15  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 11:00 Dan Carpenter
2021-09-15  9:27 ` Grygorii Strashko [this message]
2021-10-20 17:27 ` Vinod Koul

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=577c979d-647d-c0b9-0a0d-9ae5be47c2d4@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kishon@ti.com \
    --cc=linux-phy@lists.infradead.org \
    --cc=vkoul@kernel.org \
    --subject='Re: [PATCH] phy: ti: gmii-sel: check of_get_address() for failure' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).