[PATCH] stm class: Add a missing call to put_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Most error branches following the call to class_find_device contain
a call to put_device. This patch add calls to put_device where
they are missing.

This issue was found with Hector.

Signed-off-by: Quentin Lambert <lambert.quentin@xxxxxxxxx>

---
 drivers/hwtracing/stm/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -368,8 +368,10 @@ static int stm_char_open(struct inode *i
 		return -ENODEV;
 
 	stmf = kzalloc(sizeof(*stmf), GFP_KERNEL);
-	if (!stmf)
+	if (!stmf) {
+		put_device(dev);
 		return -ENOMEM;
+	}
 
 	stm_output_init(&stmf->output);
 	stmf->stm = to_stm_device(dev);
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux