All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] net: phy: Add support for Aeonsemi AS21xxx PHYs
Date: Tue, 26 Aug 2025 11:09:02 +0300	[thread overview]
Message-ID: <aK1rnmRWrCAfB9Pa@stanley.mountain> (raw)

Hello Christian Marangi,

Commit 830877d89edc ("net: phy: Add support for Aeonsemi AS21xxx
PHYs") from May 17, 2025 (linux-next), leads to the following Smatch
static checker warning:

	drivers/net/phy/as21xxx.c:561 aeon_ipc_sync_parity()
	error: uninitialized symbol 'ret_sts'.

drivers/net/phy/as21xxx.c
    538 static int aeon_ipc_sync_parity(struct phy_device *phydev,
    539                                 struct as21xxx_priv *priv)
    540 {
    541         u16 ret_sts;
    542         int ret;
    543 
    544         mutex_lock(&priv->ipc_lock);
    545 
    546         /* Send NOP with no parity */
    547         aeon_ipc_noop(phydev, priv, NULL);
    548 
    549         /* Reset packet parity */
    550         priv->parity_status = false;
    551 
    552         /* Send second NOP with no parity */
    553         ret = aeon_ipc_noop(phydev, priv, &ret_sts);
    554 
    555         mutex_unlock(&priv->ipc_lock);
    556 
    557         /* We expect to return -EINVAL */
    558         if (ret != -EINVAL)
    559                 return ret;

There are a bunch of other return -EINVAL situations before we get to
the one we're expecting...

    560 
--> 561         if ((ret_sts & AEON_IPC_STS_STATUS) != AEON_IPC_STS_STATUS_READY) {
                     ^^^^^^^
So Smatch complains that if we hit one of those then ret_sts is
uninitialized.  I mean probably it's fine...  But I just always feel
returning -EINVAL as if it has special meaning is a mistake.  There
is a subsystem which make this a core assumption and it doesn't work
but it's too much work to fix at this point.  Probably two days worth of
re-writing probe functions and no one wants to do that.

    562                 phydev_err(phydev, "Invalid IPC status on sync parity: %x\n",
    563                            ret_sts);
    564                 return -EINVAL;
    565         }
    566 
    567         return 0;
    568 }

regards,
dan carpenter

             reply	other threads:[~2025-08-26  8:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26  8:09 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-07-01 17:54 [bug report] net: phy: Add support for Aeonsemi AS21xxx PHYs Dan Carpenter

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=aK1rnmRWrCAfB9Pa@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=ansuelsmth@gmail.com \
    --cc=kernel-janitors@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.