Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* Re: USB: PHY: JZ4770: Add support for new Ingenic SoCs - bug report
@ 2020-07-27 18:08 Colin Ian King
  0 siblings, 0 replies; only message in thread
From: Colin Ian King @ 2020-07-27 18:08 UTC (permalink / raw)
  To: Zhou Yanjie, Felipe Balbi, Greg Kroah-Hartman, linux-usb; +Cc: linux-kernel

Hi,

Static analysis with Coverity has detected an issue with the following
commit:

commit 2a6c0b82e65128c73b5102e00e031c5e58bb3504
Author: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
Date:   Thu Jul 23 14:13:00 2020 +0800

    USB: PHY: JZ4770: Add support for new Ingenic SoCs.

The analysis from Coverity is as follows:

157 static int ingenic_usb_phy_init(struct usb_phy *phy)
158 {
159        struct jz4770_phy *priv = phy_to_jz4770_phy(phy);
160        int err;

1. var_decl: Declaring variable reg without initializer.

161        u32 reg;
162
163        err = regulator_enable(priv->vcc_supply);

2. Condition err, taking false branch.

164        if (err) {
165                dev_err(priv->dev, "Unable to enable VCC: %d\n", err);
166                return err;
167        }
168
169        err = clk_prepare_enable(priv->clk);

3. Condition err, taking false branch.

170        if (err) {
171                dev_err(priv->dev, "Unable to start clock: %d\n", err);
172                return err;
173        }
174
175        priv->soc_info->usb_phy_init(phy);
176
177        /* Wait for PHY to reset */
178        usleep_range(30, 300);

Uninitialized scalar variable (UNINIT)
4. uninit_use: Using uninitialized value reg.

179        writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET);
180        usleep_range(300, 1000);
181
182        return 0;
183 }


The commit removed the setting of reg in the change:

-       reg = USBPCR_AVLD_REG | USBPCR_COMMONONN | USBPCR_IDPULLUP_ALWAYS |
-               USBPCR_COMPDISTUNE_DFT | USBPCR_OTGTUNE_DFT |
USBPCR_SQRXTUNE_DFT |
-               USBPCR_TXFSLSTUNE_DFT | USBPCR_TXRISETUNE_DFT |
USBPCR_TXVREFTUNE_DFT |
-               USBPCR_POR;
-       writel(reg, priv->base + REG_USBPCR_OFFSET);

Colin

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27 18:08 USB: PHY: JZ4770: Add support for new Ingenic SoCs - bug report Colin Ian King

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git