From: Mauro Carvalho Chehab Date: Thu, 28 May 2020 10:11:57 +0000 (+0200) Subject: media: atomisp: don't cause a warn if probe failed X-Git-Tag: v5.8-rc1~10^2~51 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d9ab83953fa700cc7be319cea1ec747601a124a1;p=users%2Fwilly%2Flinux.git media: atomisp: don't cause a warn if probe failed 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 --- diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c index f9c2c7896520..c2abd14353e6 100644 --- a/drivers/staging/media/atomisp/pci/hmm/hmm.c +++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c @@ -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 */