From: Antoine Tenart <antoine.tenart@free-electrons.com>
To: Colin King <colin.king@canonical.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
Antoine Tenart <antoine.tenart@free-electrons.com>,
"David S . Miller" <davem@davemloft.net>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] phy: mvebu-cp110-comphy: fix -ve error return against a u32
Date: Fri, 01 Sep 2017 07:26:51 +0000 [thread overview]
Message-ID: <20170901072651.GB26758@kwain> (raw)
In-Reply-To: <20170831164349.2826-1-colin.king@canonical.com>
[-- Attachment #1: Type: text/plain, Size: 1970 bytes --]
Hi Colin,
On Thu, Aug 31, 2017 at 05:43:49PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The check to see if the call to mvebu_comphy_get_mux failed is always
> false because mux is a u32 and can never be less than zero. Fix this
> by making mux an int and casting to u32 on shift later on.
>
> Detected by CoverityScan, CID#1455220 ("Unsigned compared against 0")
>
> Fixes: d0438bd6aa09 ("phy: add the mvebu cp110 comphy driver")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
I actually have the very same fix in my local tree :) You sent it first
so,
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Thanks!
Antoine
> ---
> drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
> index 73ebad6634a7..7e21b2a977b9 100644
> --- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
> +++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
> @@ -468,8 +468,8 @@ static int mvebu_comphy_power_on(struct phy *phy)
> {
> struct mvebu_comphy_lane *lane = phy_get_drvdata(phy);
> struct mvebu_comphy_priv *priv = lane->priv;
> - int ret;
> - u32 mux, val;
> + int ret, mux;
> + u32 val;
>
> mux = mvebu_comphy_get_mux(lane->id, lane->port, lane->mode);
> if (mux < 0)
> @@ -477,7 +477,7 @@ static int mvebu_comphy_power_on(struct phy *phy)
>
> regmap_read(priv->regmap, MVEBU_COMPHY_SELECTOR, &val);
> val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id));
> - val |= mux << MVEBU_COMPHY_SELECTOR_PHY(lane->id);
> + val |= (u32)mux << MVEBU_COMPHY_SELECTOR_PHY(lane->id);
> regmap_write(priv->regmap, MVEBU_COMPHY_SELECTOR, val);
>
> switch (lane->mode) {
> --
> 2.14.1
>
--
Antoine Ténart, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2017-09-01 7:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-31 16:43 [PATCH][next] phy: mvebu-cp110-comphy: fix -ve error return against a u32 Colin King
2017-09-01 7:26 ` Antoine Tenart [this message]
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=20170901072651.GB26758@kwain \
--to=antoine.tenart@free-electrons.com \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kishon@ti.com \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox