Message ID | 1559577023-558-4-git-send-email-suzuki.poulose@arm.com |
---|---|
State | New |
Headers | show |
Series | [RFC,01/57] drivers: s390/cio: Use driver_for_each_device | expand |
On Mon, Jun 03, 2019 at 04:49:29PM +0100, Suzuki K Poulose wrote: > We must drop references to the device found via bus_find_device(). > > Cc: Mathieu Poirier <mathieu.poirier@linaro.org> > Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> > --- > drivers/hwtracing/coresight/coresight.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c > index 4b13028..37ccd67 100644 > --- a/drivers/hwtracing/coresight/coresight.c > +++ b/drivers/hwtracing/coresight/coresight.c > @@ -540,7 +540,7 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) > > dev = bus_find_device(&coresight_bustype, NULL, &deactivate, > coresight_enabled_sink); > - > + put_device(dev); > return dev ? to_coresight_device(dev) : NULL; You drop the reference and then use the pointer? Not good :( > } > > @@ -581,7 +581,7 @@ struct coresight_device *coresight_get_sink_by_id(u32 id) > > dev = bus_find_device(&coresight_bustype, NULL, &id, > coresight_sink_by_id); > - > + put_device(dev); > return dev ? to_coresight_device(dev) : NULL; Same here, not good :( Please fix this up and it can go in as a bugfix like any other normal patch, outside of this huge series. thanks, greg k-h
On 03/06/2019 20:08, Greg KH wrote: > On Mon, Jun 03, 2019 at 04:49:29PM +0100, Suzuki K Poulose wrote: >> We must drop references to the device found via bus_find_device(). >> >> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> >> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> >> --- >> drivers/hwtracing/coresight/coresight.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c >> index 4b13028..37ccd67 100644 >> --- a/drivers/hwtracing/coresight/coresight.c >> +++ b/drivers/hwtracing/coresight/coresight.c >> @@ -540,7 +540,7 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) >> >> dev = bus_find_device(&coresight_bustype, NULL, &deactivate, >> coresight_enabled_sink); >> - >> + put_device(dev); >> return dev ? to_coresight_device(dev) : NULL; > > You drop the reference and then use the pointer? > > Not good :( > >> } >> >> @@ -581,7 +581,7 @@ struct coresight_device *coresight_get_sink_by_id(u32 id) >> >> dev = bus_find_device(&coresight_bustype, NULL, &id, >> coresight_sink_by_id); >> - >> + put_device(dev); >> return dev ? to_coresight_device(dev) : NULL; > > Same here, not good :( > > Please fix this up and it can go in as a bugfix like any other normal > patch, outside of this huge series. > > thanks, > Sure, will do. I think there are much more of such instances lying around. :-( I will take it out of this series. Thanks Suzuki
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 4b13028..37ccd67 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -540,7 +540,7 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) dev = bus_find_device(&coresight_bustype, NULL, &deactivate, coresight_enabled_sink); - + put_device(dev); return dev ? to_coresight_device(dev) : NULL; } @@ -581,7 +581,7 @@ struct coresight_device *coresight_get_sink_by_id(u32 id) dev = bus_find_device(&coresight_bustype, NULL, &id, coresight_sink_by_id); - + put_device(dev); return dev ? to_coresight_device(dev) : NULL; }
We must drop references to the device found via bus_find_device(). Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> --- drivers/hwtracing/coresight/coresight.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4