diff mbox

ahci: qoriq: fixed using uninitialized variable warnings

Message ID 4524877.YJljz8o2LZ@wuerfel
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Arnd Bergmann Sept. 14, 2015, 7:45 a.m. UTC
On Monday 14 September 2015 14:54:32 Fengguang Wu wrote:
> On Mon, Sep 14, 2015 at 06:51:36AM +0000, Yuantian Tang wrote:
> > The ARCH should have been ARM for this driver.
> > Do you think this warning would go away if adding a dependency on ARM?
> 
> Yes, that may work.

In general, we really want to leave drivers with a COMPILE_TEST dependency
so they at least get cross-built on x86, ideally on all architectures.

Does something like the below help? I think we really just need to help
gcc a little to see the obvious.

	Arnd

Signed-off-by: Arnd Bergmann <arnd@arndb.de>


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Tejun Heo Sept. 14, 2015, 4 p.m. UTC | #1
Hello, Arnd.

On Mon, Sep 14, 2015 at 09:45:33AM +0200, Arnd Bergmann wrote:
> In general, we really want to leave drivers with a COMPILE_TEST dependency
> so they at least get cross-built on x86, ideally on all architectures.

Yeah, as long as it doesn't trigger silly warnings or errors on x86,
COMPILE_TEST is usually a good idea.

> Does something like the below help? I think we really just need to help
> gcc a little to see the obvious.

We already tried cachine qoriq_priv->type in a local.  Not sure this
would make much difference.  It looks like the warning goes away with
newer gcc.  I'm inclined to just leave it as-is.

Thanks.
diff mbox

Patch

diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
index e5e498812554..fc57208d8dcd 100644
--- a/drivers/ata/ahci_qoriq.c
+++ b/drivers/ata/ahci_qoriq.c
@@ -75,6 +75,7 @@  static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
 	u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
 	struct ata_taskfile tf;
 	bool online;
+	bool ls101021a_workaround = (qoriq_priv->type == AHCI_LS1021A);
 	int rc;
 
 	DPRINTK("ENTER\n");
@@ -92,7 +93,7 @@  static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
 	 * After the sequence is complete, software should restore the
 	 * PxCMD and PxIS with the stored values.
 	 */
-	if (qoriq_priv->type == AHCI_LS1021A) {
+	if (ls101021a_workaround) {
 		px_cmd = readl(port_mmio + PORT_CMD);
 		px_is = readl(port_mmio + PORT_IRQ_STAT);
 	}
@@ -106,7 +107,7 @@  static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
 				 ahci_check_ready);
 
 	/* restore the PxCMD and PxIS on ls1021 */
-	if (qoriq_priv->type == AHCI_LS1021A) {
+	if (ls101021a_workaround) {
 		px_val = readl(port_mmio + PORT_CMD);
 		if (px_val != px_cmd)
 			writel(px_cmd, port_mmio + PORT_CMD);