Commit a44f27e4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull libata fixes from Damien Le Moal:
 "Two sparse warning fixes and a couple of patches to fix an issue with
  sata_fsl driver module removal:

   - A couple of patches to avoid sparse warnings in libata-sata and in
     the pata_falcon driver (from Yang and Finn).

   - A couple of sata_fsl driver patches fixing IRQ free and proc
     unregister on module removal (from Baokun)"

* tag 'libata-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
  ata: replace snprintf in show functions with sysfs_emit
  sata_fsl: fix warning in remove_proc_entry when rmmod sata_fsl
  sata_fsl: fix UAF in sata_fsl_port_stop when rmmod sata_fsl
  pata_falcon: Avoid type warnings from sparse
parents 054aa8d4 06d5d558
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -827,7 +827,7 @@ static ssize_t ata_scsi_lpm_show(struct device *dev,
	if (ap->target_lpm_policy >= ARRAY_SIZE(ata_lpm_policy_names))
		return -EINVAL;

	return snprintf(buf, PAGE_SIZE, "%s\n",
	return sysfs_emit(buf, "%s\n",
			ata_lpm_policy_names[ap->target_lpm_policy]);
}
DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,
+8 −8
Original line number Diff line number Diff line
@@ -55,14 +55,14 @@ static unsigned int pata_falcon_data_xfer(struct ata_queued_cmd *qc,
	/* Transfer multiple of 2 bytes */
	if (rw == READ) {
		if (swap)
			raw_insw_swapw((u16 *)data_addr, (u16 *)buf, words);
			raw_insw_swapw(data_addr, (u16 *)buf, words);
		else
			raw_insw((u16 *)data_addr, (u16 *)buf, words);
			raw_insw(data_addr, (u16 *)buf, words);
	} else {
		if (swap)
			raw_outsw_swapw((u16 *)data_addr, (u16 *)buf, words);
			raw_outsw_swapw(data_addr, (u16 *)buf, words);
		else
			raw_outsw((u16 *)data_addr, (u16 *)buf, words);
			raw_outsw(data_addr, (u16 *)buf, words);
	}

	/* Transfer trailing byte, if any. */
@@ -74,16 +74,16 @@ static unsigned int pata_falcon_data_xfer(struct ata_queued_cmd *qc,

		if (rw == READ) {
			if (swap)
				raw_insw_swapw((u16 *)data_addr, (u16 *)pad, 1);
				raw_insw_swapw(data_addr, (u16 *)pad, 1);
			else
				raw_insw((u16 *)data_addr, (u16 *)pad, 1);
				raw_insw(data_addr, (u16 *)pad, 1);
			*buf = pad[0];
		} else {
			pad[0] = *buf;
			if (swap)
				raw_outsw_swapw((u16 *)data_addr, (u16 *)pad, 1);
				raw_outsw_swapw(data_addr, (u16 *)pad, 1);
			else
				raw_outsw((u16 *)data_addr, (u16 *)pad, 1);
				raw_outsw(data_addr, (u16 *)pad, 1);
		}
		words++;
	}
+13 −7
Original line number Diff line number Diff line
@@ -1394,6 +1394,14 @@ static int sata_fsl_init_controller(struct ata_host *host)
	return 0;
}

static void sata_fsl_host_stop(struct ata_host *host)
{
        struct sata_fsl_host_priv *host_priv = host->private_data;

        iounmap(host_priv->hcr_base);
        kfree(host_priv);
}

/*
 * scsi mid-layer and libata interface structures
 */
@@ -1426,6 +1434,8 @@ static struct ata_port_operations sata_fsl_ops = {
	.port_start = sata_fsl_port_start,
	.port_stop = sata_fsl_port_stop,

	.host_stop      = sata_fsl_host_stop,

	.pmp_attach = sata_fsl_pmp_attach,
	.pmp_detach = sata_fsl_pmp_detach,
};
@@ -1480,9 +1490,9 @@ static int sata_fsl_probe(struct platform_device *ofdev)
	host_priv->ssr_base = ssr_base;
	host_priv->csr_base = csr_base;

	irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
	if (!irq) {
		dev_err(&ofdev->dev, "invalid irq from platform\n");
	irq = platform_get_irq(ofdev, 0);
	if (irq < 0) {
		retval = irq;
		goto error_exit_with_cleanup;
	}
	host_priv->irq = irq;
@@ -1557,10 +1567,6 @@ static int sata_fsl_remove(struct platform_device *ofdev)

	ata_host_detach(host);

	irq_dispose_mapping(host_priv->irq);
	iounmap(host_priv->hcr_base);
	kfree(host_priv);

	return 0;
}