From patchwork Mon Mar 26 21:10:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10308663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5E0BD600CC for ; Mon, 26 Mar 2018 21:10:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42F56298B7 for ; Mon, 26 Mar 2018 21:10:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35D21298B9; Mon, 26 Mar 2018 21:10:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5238298B7 for ; Mon, 26 Mar 2018 21:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751890AbeCZVK5 (ORCPT ); Mon, 26 Mar 2018 17:10:57 -0400 Received: from osg.samsung.com ([64.30.133.232]:46525 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751374AbeCZVK4 (ORCPT ); Mon, 26 Mar 2018 17:10:56 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id 662E4332B0; Mon, 26 Mar 2018 14:10:56 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k-K6TH8xzm5H; Mon, 26 Mar 2018 14:10:55 -0700 (PDT) Received: from smtp.s-opensource.com (unknown [179.95.60.72]) by osg.samsung.com (Postfix) with ESMTPSA id 223B733292; Mon, 26 Mar 2018 14:10:55 -0700 (PDT) Received: from mchehab by smtp.s-opensource.com with local (Exim 4.90_1) (envelope-from ) id 1f0ZOG-00074j-H1; Mon, 26 Mar 2018 17:10:52 -0400 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Philippe Ombredanne , Arnd Bergmann Subject: [PATCH 01/18] media: r820t: don't crash if attach fails Date: Mon, 26 Mar 2018 17:10:34 -0400 Message-Id: <8548f74ae86b66d041e7505549453fba9fb9e63d.1522098456.git.mchehab@s-opensource.com> X-Mailer: git-send-email 2.14.3 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As pointed by smatch: drivers/media/tuners/r820t.c:2374 r820t_attach() error: potential null dereference 'priv'. (kzalloc returns null) The current function with prints error assumes that the attach succeeds. So, don't use it in case of failures. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/tuners/r820t.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c index bc9299059f48..3e14b9e2e763 100644 --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -20,6 +20,8 @@ // // RF Gain set/get is not implemented. +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -2371,7 +2373,7 @@ struct dvb_frontend *r820t_attach(struct dvb_frontend *fe, err_no_gate: mutex_unlock(&r820t_list_mutex); - tuner_info("%s: failed=%d\n", __func__, rc); + pr_info("%s: failed=%d\n", __func__, rc); r820t_release(fe); return NULL; }