linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ata: ahci_platform: minor fixes
@ 2018-07-12 11:41 Corentin Labbe
  2018-07-12 11:41 ` [PATCH 1/3] ata: ahci_platform: correct parameter documentation for ahci_platform_shutdown Corentin Labbe
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Corentin Labbe @ 2018-07-12 11:41 UTC (permalink / raw)
  To: hdegoede, tj; +Cc: linux-ide, linux-kernel, Corentin Labbe

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] ata: ahci_platform: correct parameter documentation for ahci_platform_shutdown
  2018-07-12 11:41 [PATCH 0/3] ata: ahci_platform: minor fixes Corentin Labbe
@ 2018-07-12 11:41 ` Corentin Labbe
  2018-07-12 11:41 ` [PATCH 2/3] ata: ahci_platform: convert kzallloc to kcalloc Corentin Labbe
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Corentin Labbe @ 2018-07-12 11:41 UTC (permalink / raw)
  To: hdegoede, tj; +Cc: linux-ide, linux-kernel, Corentin Labbe

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 <clabbe@baylibre.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] ata: ahci_platform: convert kzallloc to kcalloc
  2018-07-12 11:41 [PATCH 0/3] ata: ahci_platform: minor fixes Corentin Labbe
  2018-07-12 11:41 ` [PATCH 1/3] ata: ahci_platform: correct parameter documentation for ahci_platform_shutdown Corentin Labbe
@ 2018-07-12 11:41 ` Corentin Labbe
  2018-07-12 11:41 ` [PATCH 3/3] ata: ahci_platform: convert kcalloc to devm_kcalloc Corentin Labbe
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Corentin Labbe @ 2018-07-12 11:41 UTC (permalink / raw)
  To: hdegoede, tj; +Cc: linux-ide, linux-kernel, Corentin Labbe

It's better to kcalloc instead of kzalloc(n * sizeof())

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] ata: ahci_platform: convert kcalloc to devm_kcalloc
  2018-07-12 11:41 [PATCH 0/3] ata: ahci_platform: minor fixes Corentin Labbe
  2018-07-12 11:41 ` [PATCH 1/3] ata: ahci_platform: correct parameter documentation for ahci_platform_shutdown Corentin Labbe
  2018-07-12 11:41 ` [PATCH 2/3] ata: ahci_platform: convert kzallloc to kcalloc Corentin Labbe
@ 2018-07-12 11:41 ` Corentin Labbe
  2018-07-12 12:15 ` [PATCH 0/3] ata: ahci_platform: minor fixes Hans de Goede
  2018-07-12 20:03 ` Tejun Heo
  4 siblings, 0 replies; 6+ messages in thread
From: Corentin Labbe @ 2018-07-12 11:41 UTC (permalink / raw)
  To: hdegoede, tj; +Cc: linux-ide, linux-kernel, Corentin Labbe

Like phys, target_pwrs could be allocated with devm_ function

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] ata: ahci_platform: minor fixes
  2018-07-12 11:41 [PATCH 0/3] ata: ahci_platform: minor fixes Corentin Labbe
                   ` (2 preceding siblings ...)
  2018-07-12 11:41 ` [PATCH 3/3] ata: ahci_platform: convert kcalloc to devm_kcalloc Corentin Labbe
@ 2018-07-12 12:15 ` Hans de Goede
  2018-07-12 20:03 ` Tejun Heo
  4 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2018-07-12 12:15 UTC (permalink / raw)
  To: Corentin Labbe, tj; +Cc: linux-ide, linux-kernel

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 <hdegoede@redhat.com>

Regards,

Hans


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] ata: ahci_platform: minor fixes
  2018-07-12 11:41 [PATCH 0/3] ata: ahci_platform: minor fixes Corentin Labbe
                   ` (3 preceding siblings ...)
  2018-07-12 12:15 ` [PATCH 0/3] ata: ahci_platform: minor fixes Hans de Goede
@ 2018-07-12 20:03 ` Tejun Heo
  4 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2018-07-12 20:03 UTC (permalink / raw)
  To: Corentin Labbe; +Cc: hdegoede, linux-ide, linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-07-12 20:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 11:41 [PATCH 0/3] ata: ahci_platform: minor fixes Corentin Labbe
2018-07-12 11:41 ` [PATCH 1/3] ata: ahci_platform: correct parameter documentation for ahci_platform_shutdown Corentin Labbe
2018-07-12 11:41 ` [PATCH 2/3] ata: ahci_platform: convert kzallloc to kcalloc Corentin Labbe
2018-07-12 11:41 ` [PATCH 3/3] ata: ahci_platform: convert kcalloc to devm_kcalloc Corentin Labbe
2018-07-12 12:15 ` [PATCH 0/3] ata: ahci_platform: minor fixes Hans de Goede
2018-07-12 20:03 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).