From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFA58C2D0DC for ; Tue, 31 Dec 2019 10:20:25 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 83CF4206D9 for ; Tue, 31 Dec 2019 10:20:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83CF4206D9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mess.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-kernel-mentees-bounces@lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 467FB870F6; Tue, 31 Dec 2019 10:20:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ca+UDjfgQX7L; Tue, 31 Dec 2019 10:20:24 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id A6AD086554; Tue, 31 Dec 2019 10:20:24 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A0AA2C1D81; Tue, 31 Dec 2019 10:20:24 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 70AE0C077D for ; Tue, 31 Dec 2019 10:20:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6A89985633 for ; Tue, 31 Dec 2019 10:20:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eR2z0pknjWWC for ; Tue, 31 Dec 2019 10:20:22 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gofer.mess.org (gofer.mess.org [88.97.38.141]) by fraxinus.osuosl.org (Postfix) with ESMTPS id C9CF785617 for ; Tue, 31 Dec 2019 10:20:22 +0000 (UTC) Received: by gofer.mess.org (Postfix, from userid 1000) id CCC0111A001; Tue, 31 Dec 2019 10:20:20 +0000 (GMT) Date: Tue, 31 Dec 2019 10:20:20 +0000 From: Sean Young To: "Daniel W. S. Almeida" Message-ID: <20191231102020.GG24469@gofer.mess.org> References: <20191201161542.69535-1-dwlsalmeida@gmail.com> <20191201161542.69535-3-dwlsalmeida@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191201161542.69535-3-dwlsalmeida@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Cc: kstewart@linuxfoundation.org, linux-kernel@vger.kernel.org, rfontana@redhat.com, tglx@linutronix.de, mchehab@kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-media@vger.kernel.org Subject: Re: [Linux-kernel-mentees] [PATCH 2/6] media: dvb_dummy_fe: Add error messages in case of attach failure X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" On Sun, Dec 01, 2019 at 01:15:38PM -0300, Daniel W. S. Almeida wrote: > From: "Daniel W. S. Almeida" > > Complain if the attach functions fail, for any reason. This is helpful > when debugging. > > Suggested-by: Shuah Khan > Signed-off-by: Daniel W. S. Almeida > --- > drivers/media/dvb-frontends/dvb_dummy_fe.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/dvb-frontends/dvb_dummy_fe.c b/drivers/media/dvb-frontends/dvb_dummy_fe.c > index 909dac2345c4..987c3488fe6c 100644 > --- a/drivers/media/dvb-frontends/dvb_dummy_fe.c > +++ b/drivers/media/dvb-frontends/dvb_dummy_fe.c > @@ -114,12 +114,16 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void) > /* allocate memory for the internal state */ > state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); > if (!state) > - return NULL; > + goto err; > > /* create dvb_frontend */ > memcpy(&state->frontend.ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops)); > state->frontend.demodulator_priv = state; > return &state->frontend; > + > +err: > + pr_err("%s: DVB Dummy frontend driver attach failed\n", __func__); > + return NULL; No need to log anything after k[zm]alloc() failures. Thanks Sean > } > EXPORT_SYMBOL(dvb_dummy_fe_ofdm_attach); > > @@ -132,12 +136,16 @@ struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void) > /* allocate memory for the internal state */ > state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); > if (!state) > - return NULL; > + goto err; > > /* create dvb_frontend */ > memcpy(&state->frontend.ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops)); > state->frontend.demodulator_priv = state; > return &state->frontend; > + > +err: > + pr_err("%s: DVB Dummy frontend driver attach failed\n", __func__); > + return NULL; > } > EXPORT_SYMBOL(dvb_dummy_fe_qpsk_attach); > > @@ -150,12 +158,16 @@ struct dvb_frontend *dvb_dummy_fe_qam_attach(void) > /* allocate memory for the internal state */ > state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); > if (!state) > - return NULL; > + goto err; > > /* create dvb_frontend */ > memcpy(&state->frontend.ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops)); > state->frontend.demodulator_priv = state; > return &state->frontend; > + > +err: > + pr_err("%s: DVB Dummy frontend driver attach failed\n", __func__); > + return NULL; > } > EXPORT_SYMBOL(dvb_dummy_fe_qam_attach); > > -- > 2.24.0 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees