Hello
This patchset fixes some minor problem found when working on supporting
allwinner R40 AHCI.
Regards
Corentin Labbe (3):
ata: ahci_platform: correct parameter documentation for
ahci_platform_shutdown
ata: ahci_platform: convert kzallloc to kcalloc
ata: ahci_platform: convert kcalloc to devm_kcalloc
drivers/ata/libahci_platform.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
--
2.16.4
Like phys, target_pwrs could be allocated with devm_ function
Signed-off-by: Corentin Labbe <[email protected]>
---
drivers/ata/libahci_platform.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index be9f54423a9b..fe8939e161ea 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -271,8 +271,6 @@ static void ahci_platform_put_resources(struct device *dev, void *res)
for (c = 0; c < hpriv->nports; c++)
if (hpriv->target_pwrs && hpriv->target_pwrs[c])
regulator_put(hpriv->target_pwrs[c]);
-
- kfree(hpriv->target_pwrs);
}
static int ahci_platform_get_phy(struct ahci_host_priv *hpriv, u32 port,
@@ -408,7 +406,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev)
rc = -ENOMEM;
goto err_out;
}
- hpriv->target_pwrs = kcalloc(hpriv->nports, sizeof(*hpriv->target_pwrs), GFP_KERNEL);
+ hpriv->target_pwrs = devm_kcalloc(dev, hpriv->nports, sizeof(*hpriv->target_pwrs), GFP_KERNEL);
if (!hpriv->target_pwrs) {
rc = -ENOMEM;
goto err_out;
--
2.16.4
The documentation about parameter for ahci_platform_shutdown has a typo.
This fix the following build warning:
drivers/ata/libahci_platform.c:693: warning: Function parameter or member 'pdev' not described in 'ahci_platform_shutdown'
drivers/ata/libahci_platform.c:693: warning: Excess function parameter 'dev' description in 'ahci_platform_shutdow
Signed-off-by: Corentin Labbe <[email protected]>
---
drivers/ata/libahci_platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index feee2e11fb33..70052c046559 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -607,7 +607,7 @@ static void ahci_host_stop(struct ata_host *host)
/**
* ahci_platform_shutdown - Disable interrupts and stop DMA for host ports
- * @dev: platform device pointer for the host
+ * @pdev: platform device pointer for the host
*
* This function is called during system shutdown and performs the minimal
* deconfiguration required to ensure that an ahci_platform host cannot
--
2.16.4
It's better to kcalloc instead of kzalloc(n * sizeof())
Signed-off-by: Corentin Labbe <[email protected]>
---
drivers/ata/libahci_platform.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index 70052c046559..be9f54423a9b 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -351,7 +351,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev)
struct ahci_host_priv *hpriv;
struct clk *clk;
struct device_node *child;
- int i, sz, enabled_ports = 0, rc = -ENOMEM, child_nodes;
+ int i, enabled_ports = 0, rc = -ENOMEM, child_nodes;
u32 mask_port_map = 0;
if (!devres_open_group(dev, NULL, GFP_KERNEL))
@@ -403,14 +403,12 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev)
if (!child_nodes)
hpriv->nports = 1;
- sz = hpriv->nports * sizeof(*hpriv->phys);
- hpriv->phys = devm_kzalloc(dev, sz, GFP_KERNEL);
+ hpriv->phys = devm_kcalloc(dev, hpriv->nports, sizeof(*hpriv->phys), GFP_KERNEL);
if (!hpriv->phys) {
rc = -ENOMEM;
goto err_out;
}
- sz = hpriv->nports * sizeof(*hpriv->target_pwrs);
- hpriv->target_pwrs = kzalloc(sz, GFP_KERNEL);
+ hpriv->target_pwrs = kcalloc(hpriv->nports, sizeof(*hpriv->target_pwrs), GFP_KERNEL);
if (!hpriv->target_pwrs) {
rc = -ENOMEM;
goto err_out;
--
2.16.4
Hi,
On 12-07-18 13:41, Corentin Labbe wrote:
> Hello
>
> This patchset fixes some minor problem found when working on supporting
> allwinner R40 AHCI.
>
> Regards
Thanks.
The entire series looks good to me:
Reviewed-by: Hans de Goede <[email protected]>
Regards,
Hans
On Thu, Jul 12, 2018 at 11:41:28AM +0000, Corentin Labbe wrote:
> Hello
>
> This patchset fixes some minor problem found when working on supporting
> allwinner R40 AHCI.
>
> Regards
>
> Corentin Labbe (3):
> ata: ahci_platform: correct parameter documentation for
> ahci_platform_shutdown
> ata: ahci_platform: convert kzallloc to kcalloc
> ata: ahci_platform: convert kcalloc to devm_kcalloc
Applied all three to libata/for-4.19 with Hans's ack added.
Thanks.
--
tejun