Skip to content

Commit a44f27e

Browse files
committed
Merge tag 'libata-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata
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
2 parents 054aa8d + 06d5d55 commit a44f27e

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

drivers/ata/libata-sata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ static ssize_t ata_scsi_lpm_show(struct device *dev,
827827
if (ap->target_lpm_policy >= ARRAY_SIZE(ata_lpm_policy_names))
828828
return -EINVAL;
829829

830-
return snprintf(buf, PAGE_SIZE, "%s\n",
830+
return sysfs_emit(buf, "%s\n",
831831
ata_lpm_policy_names[ap->target_lpm_policy]);
832832
}
833833
DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,

drivers/ata/pata_falcon.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ static unsigned int pata_falcon_data_xfer(struct ata_queued_cmd *qc,
5555
/* Transfer multiple of 2 bytes */
5656
if (rw == READ) {
5757
if (swap)
58-
raw_insw_swapw((u16 *)data_addr, (u16 *)buf, words);
58+
raw_insw_swapw(data_addr, (u16 *)buf, words);
5959
else
60-
raw_insw((u16 *)data_addr, (u16 *)buf, words);
60+
raw_insw(data_addr, (u16 *)buf, words);
6161
} else {
6262
if (swap)
63-
raw_outsw_swapw((u16 *)data_addr, (u16 *)buf, words);
63+
raw_outsw_swapw(data_addr, (u16 *)buf, words);
6464
else
65-
raw_outsw((u16 *)data_addr, (u16 *)buf, words);
65+
raw_outsw(data_addr, (u16 *)buf, words);
6666
}
6767

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

7575
if (rw == READ) {
7676
if (swap)
77-
raw_insw_swapw((u16 *)data_addr, (u16 *)pad, 1);
77+
raw_insw_swapw(data_addr, (u16 *)pad, 1);
7878
else
79-
raw_insw((u16 *)data_addr, (u16 *)pad, 1);
79+
raw_insw(data_addr, (u16 *)pad, 1);
8080
*buf = pad[0];
8181
} else {
8282
pad[0] = *buf;
8383
if (swap)
84-
raw_outsw_swapw((u16 *)data_addr, (u16 *)pad, 1);
84+
raw_outsw_swapw(data_addr, (u16 *)pad, 1);
8585
else
86-
raw_outsw((u16 *)data_addr, (u16 *)pad, 1);
86+
raw_outsw(data_addr, (u16 *)pad, 1);
8787
}
8888
words++;
8989
}

drivers/ata/sata_fsl.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,14 @@ static int sata_fsl_init_controller(struct ata_host *host)
13941394
return 0;
13951395
}
13961396

1397+
static void sata_fsl_host_stop(struct ata_host *host)
1398+
{
1399+
struct sata_fsl_host_priv *host_priv = host->private_data;
1400+
1401+
iounmap(host_priv->hcr_base);
1402+
kfree(host_priv);
1403+
}
1404+
13971405
/*
13981406
* scsi mid-layer and libata interface structures
13991407
*/
@@ -1426,6 +1434,8 @@ static struct ata_port_operations sata_fsl_ops = {
14261434
.port_start = sata_fsl_port_start,
14271435
.port_stop = sata_fsl_port_stop,
14281436

1437+
.host_stop = sata_fsl_host_stop,
1438+
14291439
.pmp_attach = sata_fsl_pmp_attach,
14301440
.pmp_detach = sata_fsl_pmp_detach,
14311441
};
@@ -1480,9 +1490,9 @@ static int sata_fsl_probe(struct platform_device *ofdev)
14801490
host_priv->ssr_base = ssr_base;
14811491
host_priv->csr_base = csr_base;
14821492

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

15581568
ata_host_detach(host);
15591569

1560-
irq_dispose_mapping(host_priv->irq);
1561-
iounmap(host_priv->hcr_base);
1562-
kfree(host_priv);
1563-
15641570
return 0;
15651571
}
15661572

0 commit comments

Comments
 (0)