From: "David E. Box" Date: Tue, 17 Nov 2020 18:29:51 +0000 Subject: Re: [PATCH] platform/x86: pmt: Fix a potential Oops on error in probe Message-Id: List-Id: References: <20201117072251.GC1111239@mwanda> In-Reply-To: <20201117072251.GC1111239@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter Cc: Hans de Goede , Mark Gross , Lee Jones , platform-driver-x86@vger.kernel.org, kernel-janitors@vger.kernel.org Thanks Dan. Reviewed-by: David E. Box On Tue, 2020-11-17 at 10:22 +0300, Dan Carpenter wrote: > The "ns->attr_grp" pointer can be NULL so this error handling code > needs > to check for that to avoid an Oops. > > Fixes: e2729113ce66 ("platform/x86: Intel PMT class driver") > Signed-off-by: Dan Carpenter > --- > drivers/platform/x86/intel_pmt_class.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/intel_pmt_class.c > b/drivers/platform/x86/intel_pmt_class.c > index aa88dc23bbde..c8939fba4509 100644 > --- a/drivers/platform/x86/intel_pmt_class.c > +++ b/drivers/platform/x86/intel_pmt_class.c > @@ -225,7 +225,8 @@ static int intel_pmt_dev_register(struct > intel_pmt_entry *entry, > return 0; > > fail_ioremap: > - sysfs_remove_group(entry->kobj, ns->attr_grp); > + if (ns->attr_grp) > + sysfs_remove_group(entry->kobj, ns->attr_grp); > fail_sysfs: > device_unregister(dev); > fail_dev_create: