Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp15147302ybl; Tue, 31 Dec 2019 02:21:16 -0800 (PST) X-Google-Smtp-Source: APXvYqx2+k96I04mLmuvNvs1T78qvLlQPrtMNUIgzmtwYC5CoULpdrhS9dTyhoFTH+zNuxFuQyc5 X-Received: by 2002:a9d:6e98:: with SMTP id a24mr63037916otr.109.1577787676295; Tue, 31 Dec 2019 02:21:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577787676; cv=none; d=google.com; s=arc-20160816; b=MyXd0XJktcFdij7XTuWeOqxop/AAAriCOQ68MHJuGuV9L7EfCf/OPA4YAkznwpMuJy GKxyBah7jnCdnY6A6bLD8CZr+SBzGMXgXCR/l5I1ctg46dCnw97GonOxjFIrSXbrpl6V VFXc2XdwgLcJe9jqy8c7P9bwvaUdNHYvEotgsdCJwsI5TE+Cy5V90k6reDLKIPtlYkYw VvFob4KxSGZLdXUBrgez3F1f8vUUZD/PpQTBPwSOT0j8W1wg0skoqFPYvZOx8UXdWZZc IhgIn1+cH3zddnHC48NzknbjhBfV/AkmsEeRxrGrlHHl6m+yuLSvf+quMgdvugpp+ysV HSLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=LQ1D0uGDyAfIS389BXeBqOjAnAKzWCjNIopVHCD5oZA=; b=ejb9Bq4etX/ypaffHXMhtQFEDl77WcfxL6jvAlv8a9X/5D9IfAsDVKSJRo6AFN9age wrT86fZI+2/VOAGGvb2akj0wdNUoeQXhb78aSDSJNVkkN/BFywz4N30TaaofPRPvLEdf plv/iChihNWM9YSFAgKfdI+Q6cwGnUywYSiwTNdkrsaiyxyeefKGprGgOXYD+YBBp0S8 kvBzvNyLSmem4tlI9Y1pVygo/NMk+ueD8H+34OwB05QbJ3hetNQ9AaGXlsYQ62sbLFNO k6FfqIjWs+snCP4cpPyziKF5vzy+WOc0qag4/nC7Knn1vqz0Jf/Ulz08yr39Mhiahn6W trcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11si14916462oie.231.2019.12.31.02.21.03; Tue, 31 Dec 2019 02:21:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726709AbfLaKUX (ORCPT + 99 others); Tue, 31 Dec 2019 05:20:23 -0500 Received: from gofer.mess.org ([88.97.38.141]:37603 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbfLaKUW (ORCPT ); Tue, 31 Dec 2019 05:20:22 -0500 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" Cc: mchehab@kernel.org, gregkh@linuxfoundation.org, rfontana@redhat.com, kstewart@linuxfoundation.org, tglx@linutronix.de, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/6] media: dvb_dummy_fe: Add error messages in case of attach failure 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191201161542.69535-3-dwlsalmeida@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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