linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: sun6i: sun4i-gpadc: use of_device_get_match_data
@ 2017-09-19 18:44 Corentin Labbe
  2017-09-20  6:58 ` Maxime Ripard
  0 siblings, 1 reply; 3+ messages in thread
From: Corentin Labbe @ 2017-09-19 18:44 UTC (permalink / raw)
  To: linux-arm-kernel

The usage of of_device_get_match_data reduce the code size a bit.
Furthermore, it prevents an improbable dereference when
of_match_device() return NULL.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/dma/sun6i-dma.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index bcd496edc70f..584f4e82a9be 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -1064,7 +1064,6 @@ MODULE_DEVICE_TABLE(of, sun6i_dma_match);
 
 static int sun6i_dma_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *device;
 	struct sun6i_dma_dev *sdc;
 	struct resource *res;
 	int ret, i;
@@ -1073,10 +1072,9 @@ static int sun6i_dma_probe(struct platform_device *pdev)
 	if (!sdc)
 		return -ENOMEM;
 
-	device = of_match_device(sun6i_dma_match, &pdev->dev);
-	if (!device)
+	sdc->cfg = of_device_get_match_data(&pdev->dev);
+	if (!sdc->cfg)
 		return -ENODEV;
-	sdc->cfg = device->data;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	sdc->base = devm_ioremap_resource(&pdev->dev, res);
-- 
2.13.5

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

* [PATCH] dmaengine: sun6i: sun4i-gpadc: use of_device_get_match_data
  2017-09-19 18:44 [PATCH] dmaengine: sun6i: sun4i-gpadc: use of_device_get_match_data Corentin Labbe
@ 2017-09-20  6:58 ` Maxime Ripard
  2017-09-20  7:21   ` Corentin Labbe
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Ripard @ 2017-09-20  6:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Sep 19, 2017 at 06:44:47PM +0000, Corentin Labbe wrote:
> The usage of of_device_get_match_data reduce the code size a bit.
> Furthermore, it prevents an improbable dereference when
> of_match_device() return NULL.
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

The prefix of your commit title is wrong, this isn't about the GPADC.

Once fixed,
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170920/7ae18cac/attachment.sig>

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

* [PATCH] dmaengine: sun6i: sun4i-gpadc: use of_device_get_match_data
  2017-09-20  6:58 ` Maxime Ripard
@ 2017-09-20  7:21   ` Corentin Labbe
  0 siblings, 0 replies; 3+ messages in thread
From: Corentin Labbe @ 2017-09-20  7:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 20, 2017 at 08:58:14AM +0200, Maxime Ripard wrote:
> Hi,
> 
> On Tue, Sep 19, 2017 at 06:44:47PM +0000, Corentin Labbe wrote:
> > The usage of of_device_get_match_data reduce the code size a bit.
> > Furthermore, it prevents an improbable dereference when
> > of_match_device() return NULL.
> > 
> > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> 
> The prefix of your commit title is wrong, this isn't about the GPADC.
> 
> Once fixed,
> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> 
> Maxime
> 

A copy/paste error, sorry
I will resend
thanks
Corentin Labbe

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

end of thread, other threads:[~2017-09-20  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-19 18:44 [PATCH] dmaengine: sun6i: sun4i-gpadc: use of_device_get_match_data Corentin Labbe
2017-09-20  6:58 ` Maxime Ripard
2017-09-20  7:21   ` Corentin Labbe

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