Re: [PATCH] ahci: qoriq: fixed using uninitialized variable warnings

From: Arnd Bergmann
Date: Mon Sep 14 2015 - 03:45:53 EST


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@xxxxxxxx>

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);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/