2019-06-06 20:17:42

by David Arcari

[permalink] [raw]
Subject: [PATCH] cpufreq: pcc-cpufreq: Fail initialization if driver cannot be registered

Make pcc_cpufreq_init() return error codes when the driver cannot be
registered. Otherwise the driver can shows up loaded via lsmod even
though it failed initialization. This is confusing to the user.

Signed-off-by: David Arcari <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Viresh Kumar <[email protected]>
---
drivers/cpufreq/pcc-cpufreq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
index 1e5e64643c3a..fdc767fdbe6a 100644
--- a/drivers/cpufreq/pcc-cpufreq.c
+++ b/drivers/cpufreq/pcc-cpufreq.c
@@ -582,10 +582,10 @@ static int __init pcc_cpufreq_init(void)

/* Skip initialization if another cpufreq driver is there. */
if (cpufreq_get_current_driver())
- return 0;
+ return -EEXIST;

if (acpi_disabled)
- return 0;
+ return -ENODEV;

ret = pcc_cpufreq_probe();
if (ret) {
--
2.18.1


2019-06-07 03:10:17

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: pcc-cpufreq: Fail initialization if driver cannot be registered

On 06-06-19, 14:50, David Arcari wrote:
> Make pcc_cpufreq_init() return error codes when the driver cannot be
> registered. Otherwise the driver can shows up loaded via lsmod even
> though it failed initialization. This is confusing to the user.
>
> Signed-off-by: David Arcari <[email protected]>
> Cc: "Rafael J. Wysocki" <[email protected]>
> Cc: Viresh Kumar <[email protected]>
> ---
> drivers/cpufreq/pcc-cpufreq.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
> index 1e5e64643c3a..fdc767fdbe6a 100644
> --- a/drivers/cpufreq/pcc-cpufreq.c
> +++ b/drivers/cpufreq/pcc-cpufreq.c
> @@ -582,10 +582,10 @@ static int __init pcc_cpufreq_init(void)
>
> /* Skip initialization if another cpufreq driver is there. */
> if (cpufreq_get_current_driver())
> - return 0;
> + return -EEXIST;
>
> if (acpi_disabled)
> - return 0;
> + return -ENODEV;
>
> ret = pcc_cpufreq_probe();
> if (ret) {

Acked-by: Viresh Kumar <[email protected]>

--
viresh

2019-06-27 22:01:34

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: pcc-cpufreq: Fail initialization if driver cannot be registered

On Friday, June 7, 2019 5:05:46 AM CEST Viresh Kumar wrote:
> On 06-06-19, 14:50, David Arcari wrote:
> > Make pcc_cpufreq_init() return error codes when the driver cannot be
> > registered. Otherwise the driver can shows up loaded via lsmod even
> > though it failed initialization. This is confusing to the user.
> >
> > Signed-off-by: David Arcari <[email protected]>
> > Cc: "Rafael J. Wysocki" <[email protected]>
> > Cc: Viresh Kumar <[email protected]>
> > ---
> > drivers/cpufreq/pcc-cpufreq.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
> > index 1e5e64643c3a..fdc767fdbe6a 100644
> > --- a/drivers/cpufreq/pcc-cpufreq.c
> > +++ b/drivers/cpufreq/pcc-cpufreq.c
> > @@ -582,10 +582,10 @@ static int __init pcc_cpufreq_init(void)
> >
> > /* Skip initialization if another cpufreq driver is there. */
> > if (cpufreq_get_current_driver())
> > - return 0;
> > + return -EEXIST;
> >
> > if (acpi_disabled)
> > - return 0;
> > + return -ENODEV;
> >
> > ret = pcc_cpufreq_probe();
> > if (ret) {
>
> Acked-by: Viresh Kumar <[email protected]>

Applied, thanks!