diff mbox series

[-next] coresight: replicator: Fix missing spin_lock_init()

Message ID 20191106115651.113943-1-weiyongjun1@huawei.com (mailing list archive)
State Mainlined
Commit 9a5d847c0bdadb67892b7d176a028578aaed0c3a
Headers show
Series [-next] coresight: replicator: Fix missing spin_lock_init() | expand

Commit Message

Wei Yongjun Nov. 6, 2019, 11:56 a.m. UTC
The driver allocates the spinlock but not initialize it.
Use spin_lock_init() on it to initialize it correctly.

This is detected by Coccinelle semantic patch.

Fixes: 0093875ad129 ("coresight: Serialize enabling/disabling a link device.")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/hwtracing/coresight/coresight-replicator.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Yabin Cui Nov. 6, 2019, 6:49 p.m. UTC | #1
Thanks for the fix! I should have tested with CONFIG_DEBUG_SPINLOCK.

Tested-by: Yabin Cui <yabinc@google.com>
Mathieu Poirier Nov. 7, 2019, 6:47 p.m. UTC | #2
On Wed, 6 Nov 2019 at 04:57, Wei Yongjun <weiyongjun1@huawei.com> wrote:
>
> The driver allocates the spinlock but not initialize it.
> Use spin_lock_init() on it to initialize it correctly.
>
> This is detected by Coccinelle semantic patch.
>
> Fixes: 0093875ad129 ("coresight: Serialize enabling/disabling a link device.")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/hwtracing/coresight/coresight-replicator.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
> index 43304196a1a6..e7dc1c31d20d 100644
> --- a/drivers/hwtracing/coresight/coresight-replicator.c
> +++ b/drivers/hwtracing/coresight/coresight-replicator.c
> @@ -248,6 +248,7 @@ static int replicator_probe(struct device *dev, struct resource *res)
>         }
>         dev->platform_data = pdata;
>
> +       spin_lock_init(&drvdata->spinlock);

I have applied both patches but removed the "Fixes" line since the
commit is only visible in my local coresight next tree.

Thanks,
Mathieu

>         desc.type = CORESIGHT_DEV_TYPE_LINK;
>         desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT;
>         desc.ops = &replicator_cs_ops;
>
>
>
Dan Carpenter Nov. 8, 2019, 10:05 a.m. UTC | #3
On Thu, Nov 07, 2019 at 11:47:11AM -0700, Mathieu Poirier wrote:
> On Wed, 6 Nov 2019 at 04:57, Wei Yongjun <weiyongjun1@huawei.com> wrote:
> >
> > The driver allocates the spinlock but not initialize it.
> > Use spin_lock_init() on it to initialize it correctly.
> >
> > This is detected by Coccinelle semantic patch.
> >
> > Fixes: 0093875ad129 ("coresight: Serialize enabling/disabling a link device.")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  drivers/hwtracing/coresight/coresight-replicator.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
> > index 43304196a1a6..e7dc1c31d20d 100644
> > --- a/drivers/hwtracing/coresight/coresight-replicator.c
> > +++ b/drivers/hwtracing/coresight/coresight-replicator.c
> > @@ -248,6 +248,7 @@ static int replicator_probe(struct device *dev, struct resource *res)
> >         }
> >         dev->platform_data = pdata;
> >
> > +       spin_lock_init(&drvdata->spinlock);
> 
> I have applied both patches but removed the "Fixes" line since the
> commit is only visible in my local coresight next tree.
> 

Unless you rebase the tree, then the Fixes tag will still be valid.
(Probably local implies you rebase it I guess).

regards,
dan carpenter
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
index 43304196a1a6..e7dc1c31d20d 100644
--- a/drivers/hwtracing/coresight/coresight-replicator.c
+++ b/drivers/hwtracing/coresight/coresight-replicator.c
@@ -248,6 +248,7 @@  static int replicator_probe(struct device *dev, struct resource *res)
 	}
 	dev->platform_data = pdata;
 
+	spin_lock_init(&drvdata->spinlock);
 	desc.type = CORESIGHT_DEV_TYPE_LINK;
 	desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT;
 	desc.ops = &replicator_cs_ops;