2009-11-27 03:16:32

by Xiaotian Feng

[permalink] [raw]
Subject: [PATCH -tip] x86: reboot_fixup_32.c add missing pci_dev_put

pci_get_device increments reference count to the found pci device, that
should be decremented using pci_dev_put.

Signed-off-by: Xiaotian Feng <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: H. Peter Anvin <[email protected]>
---
arch/x86/kernel/reboot_fixups_32.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
index 61a8377..201eab6 100644
--- a/arch/x86/kernel/reboot_fixups_32.c
+++ b/arch/x86/kernel/reboot_fixups_32.c
@@ -80,6 +80,7 @@ void mach_reboot_fixups(void)
continue;

cur->reboot_fixup(dev);
+ pci_dev_put(dev);
}
}

--
1.6.5.2


2009-12-02 10:09:58

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: reboot_fixup_32.c add missing pci_dev_put


* Xiaotian Feng <[email protected]> wrote:

> pci_get_device increments reference count to the found pci device,
> that should be decremented using pci_dev_put.

> +++ b/arch/x86/kernel/reboot_fixups_32.c
> @@ -80,6 +80,7 @@ void mach_reboot_fixups(void)
> continue;
>
> cur->reboot_fixup(dev);
> + pci_dev_put(dev);

Does this matter in practice? We are about to reboot. (but if it's
cleaner to do it like this or if there's some real bug fixed by this
then please spell it out in the changelog.)

Ingo

2009-12-02 16:53:14

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: reboot_fixup_32.c add missing pci_dev_put

On 12/02/2009 02:09 AM, Ingo Molnar wrote:
>
> * Xiaotian Feng <[email protected]> wrote:
>
>> pci_get_device increments reference count to the found pci device,
>> that should be decremented using pci_dev_put.
>
>> +++ b/arch/x86/kernel/reboot_fixups_32.c
>> @@ -80,6 +80,7 @@ void mach_reboot_fixups(void)
>> continue;
>>
>> cur->reboot_fixup(dev);
>> + pci_dev_put(dev);
>
> Does this matter in practice? We are about to reboot. (but if it's
> cleaner to do it like this or if there's some real bug fixed by this
> then please spell it out in the changelog.)
>

Even if it doesn't actually matter, doing things cleanly makes it easier
to handle failure scenarios, possibly that are discovered in the future.

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

2009-12-02 17:14:48

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: reboot_fixup_32.c add missing pci_dev_put


* H. Peter Anvin <[email protected]> wrote:

> On 12/02/2009 02:09 AM, Ingo Molnar wrote:
> >
> > * Xiaotian Feng <[email protected]> wrote:
> >
> >> pci_get_device increments reference count to the found pci device,
> >> that should be decremented using pci_dev_put.
> >
> >> +++ b/arch/x86/kernel/reboot_fixups_32.c
> >> @@ -80,6 +80,7 @@ void mach_reboot_fixups(void)
> >> continue;
> >>
> >> cur->reboot_fixup(dev);
> >> + pci_dev_put(dev);
> >
> > Does this matter in practice? We are about to reboot. (but if it's
> > cleaner to do it like this or if there's some real bug fixed by this
> > then please spell it out in the changelog.)
> >
>
> Even if it doesn't actually matter, doing things cleanly makes it
> easier to handle failure scenarios, possibly that are discovered in
> the future.

certainly - but it would be nice to know whether there's any other
reason for this but cleanliness/consistency.

Ingo

2009-12-03 10:07:55

by Xiaotian Feng

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: reboot_fixup_32.c add missing pci_dev_put

On 12/03/2009 01:14 AM, Ingo Molnar wrote:
>
> * H. Peter Anvin<[email protected]> wrote:
>
>> On 12/02/2009 02:09 AM, Ingo Molnar wrote:
>>>
>>> * Xiaotian Feng<[email protected]> wrote:
>>>
>>>> pci_get_device increments reference count to the found pci device,
>>>> that should be decremented using pci_dev_put.
>>>
>>>> +++ b/arch/x86/kernel/reboot_fixups_32.c
>>>> @@ -80,6 +80,7 @@ void mach_reboot_fixups(void)
>>>> continue;
>>>>
>>>> cur->reboot_fixup(dev);
>>>> + pci_dev_put(dev);
>>>
>>> Does this matter in practice? We are about to reboot. (but if it's
>>> cleaner to do it like this or if there's some real bug fixed by this
>>> then please spell it out in the changelog.)
>>>
>>
>> Even if it doesn't actually matter, doing things cleanly makes it
>> easier to handle failure scenarios, possibly that are discovered in
>> the future.
>
> certainly - but it would be nice to know whether there's any other
> reason for this but cleanliness/consistency.

Just for consistency:-) pci_get_device will increase the ref count of
found device,
then we should use pci_dev_put to decrease the ref count although we're
going to reset soon.
I should point out this in my changelog, sorry for the unclear changelog.

>
> Ingo
>

2009-12-03 10:41:28

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: reboot_fixup_32.c add missing pci_dev_put


* Danny Feng <[email protected]> wrote:

> I should point out this in my changelog, sorry for the unclear
> changelog.

Please re-send it with a better changelog.

Thanks,

Ingo

2009-12-03 11:07:09

by Xiaotian Feng

[permalink] [raw]
Subject: [PATCH -tip] x86/trivial: add pci_dev_put in reboot_fixup_32.c for consistency

pci_get_device will increase the ref count of found device.
Although we're going to reset soon, we should use pci_dev_put
to decrease the ref count for consistency.

Signed-off-by: Xiaotian Feng <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Yinghai Lu <[email protected]>
---
arch/x86/kernel/reboot_fixups_32.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
index 61a8377..201eab6 100644
--- a/arch/x86/kernel/reboot_fixups_32.c
+++ b/arch/x86/kernel/reboot_fixups_32.c
@@ -80,6 +80,7 @@ void mach_reboot_fixups(void)
continue;

cur->reboot_fixup(dev);
+ pci_dev_put(dev);
}
}

--
1.5.5.6

2009-12-03 13:24:24

by Xiaotian Feng

[permalink] [raw]
Subject: [tip:x86/reboot] x86/reboot: Add pci_dev_put in reboot_fixup_32.c for consistency

Commit-ID: 57fea8f7ab67ef42b7f84999e49e47f8717a2d5b
Gitweb: http://git.kernel.org/tip/57fea8f7ab67ef42b7f84999e49e47f8717a2d5b
Author: Xiaotian Feng <[email protected]>
AuthorDate: Thu, 3 Dec 2009 19:06:40 +0800
Committer: Ingo Molnar <[email protected]>
CommitDate: Thu, 3 Dec 2009 12:17:55 +0100

x86/reboot: Add pci_dev_put in reboot_fixup_32.c for consistency

pci_get_device will increase the ref count of found device.
Although we're going to reset soon, we should use pci_dev_put
to decrease the ref count for consistency.

Signed-off-by: Xiaotian Feng <[email protected]>
Acked-by: H. Peter Anvin <[email protected]>
Cc: Yinghai Lu <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/kernel/reboot_fixups_32.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
index 61a8377..201eab6 100644
--- a/arch/x86/kernel/reboot_fixups_32.c
+++ b/arch/x86/kernel/reboot_fixups_32.c
@@ -80,6 +80,7 @@ void mach_reboot_fixups(void)
continue;

cur->reboot_fixup(dev);
+ pci_dev_put(dev);
}
}