ipmi: Fix some error cleanup issues
authorCorey Minyard <cminyard@mvista.com>
Wed, 28 Feb 2018 14:09:49 +0000 (08:09 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Apr 2018 06:55:08 +0000 (08:55 +0200)
commit351b3d90c18d88bb719739257cce42e2f13af9a1
tree926509ecda027fbde5652d0b6ef406468e19e4bb
parent9bb8f59e6ba040a38ded403e154889b763f3cb64
ipmi: Fix some error cleanup issues

commit cc095f0ac1f7c200e51a5c2a78a43c9f42049dbb upstream.

device_remove_group() was called on any cleanup, even if the
device attrs had not been added yet.  That can occur in certain
error scenarios, so add a flag to know if it has been added.

Also make sure we remove the dev if we added it ourselves.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: stable@vger.kernel.org # 4.15
Cc: Laura Abbott <labbott@redhat.com>
Tested-by: Bill Perkins <wmp@grnwood.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/ipmi/ipmi_si_intf.c