[Openipmi-developer] [PATCH] ipmi:ssif: Fix double probe from tryacpi and trydmi

2018-03-06 Thread Jiandi An
IPMI SSIF driver's parameter tryacpi and trydmi both
are set to true.  The addition of IPMI DMI driver to
create platform device for each IPMI device causes
SSIF probe to be done twice on the same SMB I2C address
for BMC.  Fix is to not call trydmi if tryacpi is able
to find I2C address for BMC from SPMI ACPI table and
probe successfully.

Signed-off-by: Jiandi An 
---
 drivers/char/ipmi/ipmi_ssif.c | 35 ---
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 9d3b0fa..5c57363 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1981,29 +1981,41 @@ static int try_init_spmi(struct SPMITable *spmi)
return new_ssif_client(myaddr, NULL, 0, 0, SI_SPMI, NULL);
 }
 
-static void spmi_find_bmc(void)
+static int spmi_find_bmc(void)
 {
acpi_status  status;
struct SPMITable *spmi;
int  i;
+   int  rc = 0;
 
if (acpi_disabled)
-   return;
+   return -EPERM;
 
if (acpi_failure)
-   return;
+   return -ENODEV;
 
for (i = 0; ; i++) {
status = acpi_get_table(ACPI_SIG_SPMI, i+1,
(struct acpi_table_header **));
-   if (status != AE_OK)
-   return;
+   if (status != AE_OK) {
+   if (i == 0)
+   return -ENODEV;
+   else
+   return 0;
+   }
 
-   try_init_spmi(spmi);
+   rc = try_init_spmi(spmi);
+   if (rc)
+   return rc;
}
+
+   return 0;
 }
 #else
-static void spmi_find_bmc(void) { }
+static int spmi_find_bmc(void)
+{
+   return -ENODEV;
+}
 #endif
 
 #ifdef CONFIG_DMI
@@ -2104,12 +2116,13 @@ static int init_ipmi_ssif(void)
   addr[i]);
}
 
-   if (ssif_tryacpi)
+   if (ssif_tryacpi) {
ssif_i2c_driver.driver.acpi_match_table =
ACPI_PTR(ssif_acpi_match);
-
-   if (ssif_tryacpi)
-   spmi_find_bmc();
+   rv = spmi_find_bmc();
+   if (!rv)
+   ssif_trydmi = false;
+   }
 
if (ssif_trydmi) {
rv = platform_driver_register(_driver);
-- 
Jiandi An
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm 
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux 
Foundation Collaborative Project.


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] Regression in IPMI on 4.15.6

2018-03-06 Thread Corey Minyard

On 03/06/2018 05:54 PM, Laura Abbott wrote:

On 03/06/2018 09:19 AM, Corey Minyard wrote:

On 03/06/2018 11:17 AM, Laura Abbott wrote:

On 03/05/2018 11:39 AM, Corey Minyard wrote:

On 03/05/2018 01:31 PM, Corey Minyard wrote:

On 03/05/2018 01:07 PM, Laura Abbott wrote:

On 03/02/2018 05:46 AM, Corey Minyard wrote:

On 02/28/2018 01:07 PM, Corey Minyard wrote:

On 02/28/2018 08:17 AM, Corey Minyard wrote:

On 02/28/2018 07:53 AM, Corey Minyard wrote:

On 02/27/2018 05:55 PM, Laura Abbott wrote:

Hi,

Fedora got a bug report of a crash in IPMI on 4.15.6
https://bugzilla.redhat.com/show_bug.cgi?id=1549316
Unfortunately, it's only a screenshot but it's fairly
clear. It looks like a panic in the error handling path
in platform_device_unregister. Any ideas?





You may also run into another issue.  You can pull the
individual patch at

https://github.com/cminyard/linux-ipmi.git 
c8a1972e77dbe321ce5ce0247056e727234cbaec


Actually, it needed a few more tweaks.  Can you do change
426fa6179dae677134dfb37b21d057819418515b
instead?  It's "ipmi: Fix some error cleanup issues"

I can send you patches, if you like.  If you could test and get 
back

to me, that would be great.


Laura, have you had a chance to test this?  I'd like to get it 
in soon,

if possible.

Thanks,

-corey



I think "ipmi: Re-use existing macros for built-in properties" is 
broken:




That particular requires some new stuff.  I was just wanting you 
to pull that individual patch,

not the whole branch.  I can just send the two patches, if you like.


Or, I just pulled in 4.15.6 and cherry picked those two patches to:

https://github.com/cminyard/linux-ipmi.git fix-pdev-unreg

Hopefully that makes things easier.

-corey



Yes, the reporter said it worked fine.



It would be helpful to me to have a "Tested-by" line.  Can I put one in?
If so, whose name/email do I use?

Thanks for testing.

-corey



You can use the reporter and tester:

Tested-by: Bill Perkins 


Thanks a bunch, Laura.  I have it queued for 4.17, and
backport to 4.15 and 4.16.  If you need it sooner, I can
send it to Linus now.

-corey


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] Regression in IPMI on 4.15.6

2018-03-06 Thread Laura Abbott

On 03/06/2018 09:19 AM, Corey Minyard wrote:

On 03/06/2018 11:17 AM, Laura Abbott wrote:

On 03/05/2018 11:39 AM, Corey Minyard wrote:

On 03/05/2018 01:31 PM, Corey Minyard wrote:

On 03/05/2018 01:07 PM, Laura Abbott wrote:

On 03/02/2018 05:46 AM, Corey Minyard wrote:

On 02/28/2018 01:07 PM, Corey Minyard wrote:

On 02/28/2018 08:17 AM, Corey Minyard wrote:

On 02/28/2018 07:53 AM, Corey Minyard wrote:

On 02/27/2018 05:55 PM, Laura Abbott wrote:

Hi,

Fedora got a bug report of a crash in IPMI on 4.15.6
https://bugzilla.redhat.com/show_bug.cgi?id=1549316
Unfortunately, it's only a screenshot but it's fairly
clear. It looks like a panic in the error handling path
in platform_device_unregister. Any ideas?





You may also run into another issue.  You can pull the
individual patch at

https://github.com/cminyard/linux-ipmi.git 
c8a1972e77dbe321ce5ce0247056e727234cbaec


Actually, it needed a few more tweaks.  Can you do change
426fa6179dae677134dfb37b21d057819418515b
instead?  It's "ipmi: Fix some error cleanup issues"

I can send you patches, if you like.  If you could test and get back
to me, that would be great.


Laura, have you had a chance to test this?  I'd like to get it in soon,
if possible.

Thanks,

-corey



I think "ipmi: Re-use existing macros for built-in properties" is broken:



That particular requires some new stuff.  I was just wanting you to pull that 
individual patch,
not the whole branch.  I can just send the two patches, if you like.


Or, I just pulled in 4.15.6 and cherry picked those two patches to:

https://github.com/cminyard/linux-ipmi.git fix-pdev-unreg

Hopefully that makes things easier.

-corey



Yes, the reporter said it worked fine.



It would be helpful to me to have a "Tested-by" line.  Can I put one in?
If so, whose name/email do I use?

Thanks for testing.

-corey



You can use the reporter and tester:

Tested-by: Bill Perkins 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] Regression in IPMI on 4.15.6

2018-03-06 Thread Corey Minyard

On 03/06/2018 11:17 AM, Laura Abbott wrote:

On 03/05/2018 11:39 AM, Corey Minyard wrote:

On 03/05/2018 01:31 PM, Corey Minyard wrote:

On 03/05/2018 01:07 PM, Laura Abbott wrote:

On 03/02/2018 05:46 AM, Corey Minyard wrote:

On 02/28/2018 01:07 PM, Corey Minyard wrote:

On 02/28/2018 08:17 AM, Corey Minyard wrote:

On 02/28/2018 07:53 AM, Corey Minyard wrote:

On 02/27/2018 05:55 PM, Laura Abbott wrote:

Hi,

Fedora got a bug report of a crash in IPMI on 4.15.6
https://bugzilla.redhat.com/show_bug.cgi?id=1549316
Unfortunately, it's only a screenshot but it's fairly
clear. It looks like a panic in the error handling path
in platform_device_unregister. Any ideas?





You may also run into another issue.  You can pull the
individual patch at

https://github.com/cminyard/linux-ipmi.git 
c8a1972e77dbe321ce5ce0247056e727234cbaec


Actually, it needed a few more tweaks.  Can you do change
426fa6179dae677134dfb37b21d057819418515b
instead?  It's "ipmi: Fix some error cleanup issues"

I can send you patches, if you like.  If you could test and get back
to me, that would be great.


Laura, have you had a chance to test this?  I'd like to get it in 
soon,

if possible.

Thanks,

-corey



I think "ipmi: Re-use existing macros for built-in properties" is 
broken:




That particular requires some new stuff.  I was just wanting you to 
pull that individual patch,

not the whole branch.  I can just send the two patches, if you like.


Or, I just pulled in 4.15.6 and cherry picked those two patches to:

https://github.com/cminyard/linux-ipmi.git fix-pdev-unreg

Hopefully that makes things easier.

-corey



Yes, the reporter said it worked fine.



It would be helpful to me to have a "Tested-by" line.  Can I put one in?
If so, whose name/email do I use?

Thanks for testing.

-corey


Thanks,
Laura




--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] Regression in IPMI on 4.15.6

2018-03-06 Thread Laura Abbott

On 03/05/2018 11:39 AM, Corey Minyard wrote:

On 03/05/2018 01:31 PM, Corey Minyard wrote:

On 03/05/2018 01:07 PM, Laura Abbott wrote:

On 03/02/2018 05:46 AM, Corey Minyard wrote:

On 02/28/2018 01:07 PM, Corey Minyard wrote:

On 02/28/2018 08:17 AM, Corey Minyard wrote:

On 02/28/2018 07:53 AM, Corey Minyard wrote:

On 02/27/2018 05:55 PM, Laura Abbott wrote:

Hi,

Fedora got a bug report of a crash in IPMI on 4.15.6
https://bugzilla.redhat.com/show_bug.cgi?id=1549316
Unfortunately, it's only a screenshot but it's fairly
clear. It looks like a panic in the error handling path
in platform_device_unregister. Any ideas?





You may also run into another issue.  You can pull the
individual patch at

https://github.com/cminyard/linux-ipmi.git 
c8a1972e77dbe321ce5ce0247056e727234cbaec


Actually, it needed a few more tweaks.  Can you do change
426fa6179dae677134dfb37b21d057819418515b
instead?  It's "ipmi: Fix some error cleanup issues"

I can send you patches, if you like.  If you could test and get back
to me, that would be great.


Laura, have you had a chance to test this?  I'd like to get it in soon,
if possible.

Thanks,

-corey



I think "ipmi: Re-use existing macros for built-in properties" is broken:



That particular requires some new stuff.  I was just wanting you to pull that 
individual patch,
not the whole branch.  I can just send the two patches, if you like.


Or, I just pulled in 4.15.6 and cherry picked those two patches to:

https://github.com/cminyard/linux-ipmi.git fix-pdev-unreg

Hopefully that makes things easier.

-corey



Yes, the reporter said it worked fine.

Thanks,
Laura

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] [PATCH] ipmi: missing error code in try_smi_init()

2018-03-06 Thread Corey Minyard

On 03/06/2018 03:58 AM, Dan Carpenter wrote:

If platform_device_alloc() then we should return -ENOMEM instead of
returning success.


Thanks, queued for next release.

-corey


Signed-off-by: Dan Carpenter 

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index f2a294f78892..ff870aa91cfe 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2071,6 +2071,7 @@ static int try_smi_init(struct smi_info *new_smi)
  new_smi->intf_num);
if (!new_smi->pdev) {
pr_err(PFX "Unable to allocate platform device\n");
+   rv = -ENOMEM;
goto out_err;
}
new_smi->io.dev = _smi->pdev->dev;




--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] [PATCH v2] ipmi: Fix error code in try_smi_init()

2018-03-06 Thread Arnd Bergmann
On Tue, Mar 6, 2018 at 11:40 AM, Dan Carpenter  wrote:
> If platform_device_alloc() fails, then we should return -ENOMEM instead
> of returning success.  I've also removed the "rv" initialization so that
> GCC can maybe detect if we forget to set it in the future.
>
> Signed-off-by: Dan Carpenter 
> ---
> v2: Don't initialize "rv" and fix a typo in the commit message

This addresses my comment, so

Acked-by: Arnd Bergmann 

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


[Openipmi-developer] [PATCH v2] ipmi: Fix error code in try_smi_init()

2018-03-06 Thread Dan Carpenter
If platform_device_alloc() fails, then we should return -ENOMEM instead
of returning success.  I've also removed the "rv" initialization so that
GCC can maybe detect if we forget to set it in the future.

Signed-off-by: Dan Carpenter 
---
v2: Don't initialize "rv" and fix a typo in the commit message

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index f2a294f78892..c09b279cd55e 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2026,7 +2026,7 @@ int ipmi_si_add_smi(struct si_sm_io *io)
  */
 static int try_smi_init(struct smi_info *new_smi)
 {
-   int rv = 0;
+   int rv;
int i;
char *init_name = NULL;
 
@@ -2071,6 +2071,7 @@ static int try_smi_init(struct smi_info *new_smi)
  new_smi->intf_num);
if (!new_smi->pdev) {
pr_err(PFX "Unable to allocate platform device\n");
+   rv = -ENOMEM;
goto out_err;
}
new_smi->io.dev = _smi->pdev->dev;

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] [PATCH] ipmi: missing error code in try_smi_init()

2018-03-06 Thread Dan Carpenter
On Tue, Mar 06, 2018 at 11:26:19AM +0100, Julia Lawall wrote:
> 
> 
> On Tue, 6 Mar 2018, Dan Carpenter wrote:
> 
> > If platform_device_alloc() then we should return -ENOMEM instead of
> > returning success.
> 
> It looks like the word "fails" got lost here.
> 

Thanks.  Let me resend.

regards,
dan carpenter


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] [PATCH] ipmi: missing error code in try_smi_init()

2018-03-06 Thread Julia Lawall


On Tue, 6 Mar 2018, Dan Carpenter wrote:

> If platform_device_alloc() then we should return -ENOMEM instead of
> returning success.

It looks like the word "fails" got lost here.

julia

>
> Signed-off-by: Dan Carpenter 
>
> diff --git a/drivers/char/ipmi/ipmi_si_intf.c 
> b/drivers/char/ipmi/ipmi_si_intf.c
> index f2a294f78892..ff870aa91cfe 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -2071,6 +2071,7 @@ static int try_smi_init(struct smi_info *new_smi)
> new_smi->intf_num);
>   if (!new_smi->pdev) {
>   pr_err(PFX "Unable to allocate platform device\n");
> + rv = -ENOMEM;
>   goto out_err;
>   }
>   new_smi->io.dev = _smi->pdev->dev;
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] [PATCH] ipmi: missing error code in try_smi_init()

2018-03-06 Thread Arnd Bergmann
On Tue, Mar 6, 2018 at 10:58 AM, Dan Carpenter  wrote:
> If platform_device_alloc() then we should return -ENOMEM instead of
> returning success.
>
> Signed-off-by: Dan Carpenter 

Looks good, though I would probably remove that incorrect 'rv = 0' as well
so gcc can catch similar problems in case the function gets changed
again.

> diff --git a/drivers/char/ipmi/ipmi_si_intf.c 
> b/drivers/char/ipmi/ipmi_si_intf.c
> index f2a294f78892..ff870aa91cfe 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -2071,6 +2071,7 @@ static int try_smi_init(struct smi_info *new_smi)
>   new_smi->intf_num);
> if (!new_smi->pdev) {
> pr_err(PFX "Unable to allocate platform device\n");
> +   rv = -ENOMEM;
> goto out_err;
> }
> new_smi->io.dev = _smi->pdev->dev;

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


[Openipmi-developer] [PATCH] ipmi: missing error code in try_smi_init()

2018-03-06 Thread Dan Carpenter
If platform_device_alloc() then we should return -ENOMEM instead of
returning success.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index f2a294f78892..ff870aa91cfe 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2071,6 +2071,7 @@ static int try_smi_init(struct smi_info *new_smi)
  new_smi->intf_num);
if (!new_smi->pdev) {
pr_err(PFX "Unable to allocate platform device\n");
+   rv = -ENOMEM;
goto out_err;
}
new_smi->io.dev = _smi->pdev->dev;

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer