Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1330025 > unrolled thread

Re: [PATCH] drivers: stm: correct the index in master array release

Started byAlexander Shishkin <alexander.shishkin@linux.intel.com>
First post2016-02-09 11:20 +0100
Last post2016-02-15 11:40 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] drivers: stm: correct the index in master array release Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-09 11:20 +0100
    Re: [PATCH] drivers: stm: correct the index in master array release Chunyan Zhang <zhang.chunyan@linaro.org> - 2016-02-14 07:30 +0100
      Re: [PATCH] drivers: stm: correct the index in master array release Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 11:40 +0100

#1330025 — Re: [PATCH] drivers: stm: correct the index in master array release

FromAlexander Shishkin <alexander.shishkin@linux.intel.com>
Date2016-02-09 11:20 +0100
SubjectRe: [PATCH] drivers: stm: correct the index in master array release
Message-ID<r0dyP-2DB-29@gated-at.bofh.it>
Chunyan Zhang <zhang.chunyan@linaro.org> writes:

> It would be broken if stm_data->sw_start isn't zero, because that
> stp_master_free() get the 'master' with __stm_master()/stm_master(),
> in which the masterID is the second input parameter minus
> stm_data->sw_start. So freeing STM masters has to start from
> stm_data->sw_start.

No, it won't. stm_master_free() handles nonexistent masters correctly.
It does make sense to shrink the loop in stm_unregister_device() to
avoid going through the [0..sw_start) range, since stm_master() returns
NULL for those, but not for the reasons given in this patch description.

Regards,
--
Alex

[toc] | [next] | [standalone]


#1333430

FromChunyan Zhang <zhang.chunyan@linaro.org>
Date2016-02-14 07:30 +0100
Message-ID<r1YlY-7rJ-17@gated-at.bofh.it>
In reply to#1330025
On Tue, Feb 9, 2016 at 6:12 PM, Alexander Shishkin
<alexander.shishkin@linux.intel.com> wrote:
> Chunyan Zhang <zhang.chunyan@linaro.org> writes:
>
>> It would be broken if stm_data->sw_start isn't zero, because that
>> stp_master_free() get the 'master' with __stm_master()/stm_master(),
>> in which the masterID is the second input parameter minus
>> stm_data->sw_start. So freeing STM masters has to start from
>> stm_data->sw_start.
>
> No, it won't. stm_master_free() handles nonexistent masters correctly.
> It does make sense to shrink the loop in stm_unregister_device() to
> avoid going through the [0..sw_start) range, since stm_master() returns
> NULL for those, but not for the reasons given in this patch description.

Let's assume sw_start = 64, sw_end = 79, sw_nmasters should be 16, if
the loop goes through [0..16), the existed masters will not be freed.
That's what I wanted to address in this patch. I meant the number of
loop in stm_unregister_device() is correct, but the start index isn't.
Sorry for not describing clear enough in the patch logs.

Thanks,
Chunyan

>
> Regards,
> --
> Alex

[toc] | [prev] | [next] | [standalone]


#1334368

FromAlexander Shishkin <alexander.shishkin@linux.intel.com>
Date2016-02-15 11:40 +0100
Message-ID<r2oJs-85E-29@gated-at.bofh.it>
In reply to#1333430
Chunyan Zhang <zhang.chunyan@linaro.org> writes:

> On Tue, Feb 9, 2016 at 6:12 PM, Alexander Shishkin
> <alexander.shishkin@linux.intel.com> wrote:
>> Chunyan Zhang <zhang.chunyan@linaro.org> writes:
>>
>>> It would be broken if stm_data->sw_start isn't zero, because that
>>> stp_master_free() get the 'master' with __stm_master()/stm_master(),
>>> in which the masterID is the second input parameter minus
>>> stm_data->sw_start. So freeing STM masters has to start from
>>> stm_data->sw_start.
>>
>> No, it won't. stm_master_free() handles nonexistent masters correctly.
>> It does make sense to shrink the loop in stm_unregister_device() to
>> avoid going through the [0..sw_start) range, since stm_master() returns
>> NULL for those, but not for the reasons given in this patch description.
>
> Let's assume sw_start = 64, sw_end = 79, sw_nmasters should be 16, if
> the loop goes through [0..16), the existed masters will not be freed.

Ah yes, you're right, of course.

I'll add this fix to the queue with a proper description.

Thanks,
--
Alex

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web