From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757079AbbA2Sov (ORCPT ); Thu, 29 Jan 2015 13:44:51 -0500 Received: from mail-lb0-f177.google.com ([209.85.217.177]:39093 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754886AbbA2Sot (ORCPT ); Thu, 29 Jan 2015 13:44:49 -0500 From: Rickard Strandqvist To: Jarod Wilson , Mauro Carvalho Chehab Cc: Rickard Strandqvist , Greg Kroah-Hartman , Aya Mahfouz , Gulsah Kose , Tuomas Tynkkynen , Martin Kaiser , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: media: lirc: lirc_zilog: Fix for possible null pointer dereference Date: Thu, 29 Jan 2015 19:48:08 +0100 Message-Id: <1422557288-3617-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix a possible null pointer dereference, there is otherwise a risk of a possible null pointer dereference. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist --- drivers/staging/media/lirc/lirc_zilog.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index cc872fb..78ce3b0 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -1332,10 +1332,8 @@ static int close(struct inode *node, struct file *filep) /* find our IR struct */ struct IR *ir = filep->private_data; - if (ir == NULL) { - dev_err(ir->l.dev, "close: no private_data attached to the file!\n"); + if (ir == NULL) return -ENODEV; - } atomic_dec(&ir->open_count); -- 1.7.10.4