media: atomisp: don't cause a warn if probe failed
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 28 May 2020 10:11:57 +0000 (12:11 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 11 Jun 2020 16:24:23 +0000 (18:24 +0200)
When probe fails, it is possible that hmm_init() to not be
called. On such case, hmm_cleanup() will cause a WARN_ON().

Avoid it by adding an explicit check at hmm_cleanup() to
ensure that the hmm code was properly initialized.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/hmm/hmm.c

index f9c2c7896520558ff20b3b8e03dd2e3971e0cd55..c2abd14353e6845bd8a3dd78bc9ea07efa57e159 100644 (file)
@@ -208,6 +208,8 @@ int hmm_init(void)
 
 void hmm_cleanup(void)
 {
+       if (!dummy_ptr)
+               return;
        sysfs_remove_group(&atomisp_dev->kobj, atomisp_attribute_group);
 
        /* free dummy memory first */