Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp15121708ybl; Tue, 31 Dec 2019 01:48:00 -0800 (PST) X-Google-Smtp-Source: APXvYqylH8Bd6EzpLBVGjNAYhvqdGjzuaeXnsNlbmgV5Cuvn18Ew4/iaeKdtj63OdKEMf6w70TS6 X-Received: by 2002:a05:6830:1e1c:: with SMTP id s28mr29397876otr.335.1577785680339; Tue, 31 Dec 2019 01:48:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577785680; cv=none; d=google.com; s=arc-20160816; b=qIxGeZiVNwWNHGAcPoBswppUl9ffS/YTi0roh4hWOn7NX9KJNHIpenYyIiRcQ9u/tm HKhyldYWlohaVbXzbw60Z2NY4E5Slr0oNL8KNA31qQQNlCwJN0Rel2EBsf3BhXNenbLm fv6mdie0BF0absNMjU2F2Hbc1DHiLAFAPb/iOLdC6lcpn2FnYaj3Nwzyarix9uPqOsLm I7XMVvZZR8CAPQ1tTEwndu2H/mwRZR8lPPScxlW+AxShroQbKaHjn0jUp7jQuLlJpnEp NiCaQEK9tDpA6P2QkKkfpU7FEogrgX+hm1Z1LkmEAqT0YShOj2HFjcLwIMiZmJlr4AVr hRRQ== 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=BrXzaAlEIVy6qNVRsLYdgciLD2QITKPrGFMIjaZYYa4=; b=BNL/RYYoYZDLbqx+J5LZ+YhjI41C59oxZ7GTrD+J5+lBOevnYnh+/1MbE/k6OQWDw0 8o/myAl5y0X9jU3tXC02oGWRjyt2YzZYvi9DdYcNqdiB7yWoGmf0OW0WHIwQUjiZPf1T FO3laiIQQ+r0wKcB1jWMG9+GBycPjr2ldQSwX1Dt3OAPFSgBK40v/6tR58tYJAs/tnCP Fiqfeec9W0NnvN26pprBdqjyQ2AkY2TEMu8r8b8n5Mzx2PtnZr4+cTtDo+dPgGHFGMAz lg5T4ydk9WVw4GBkPtF13pNCVXgGSt/9RTIWogjFyP/DLEjEjonQ71TkqRzUv01uENjx hMbA== 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 f21si24999556otp.56.2019.12.31.01.47.47; Tue, 31 Dec 2019 01:48:00 -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 S1726208AbfLaJrJ (ORCPT + 99 others); Tue, 31 Dec 2019 04:47:09 -0500 Received: from gofer.mess.org ([88.97.38.141]:46179 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725770AbfLaJrI (ORCPT ); Tue, 31 Dec 2019 04:47:08 -0500 Received: by gofer.mess.org (Postfix, from userid 1000) id EDD6D11A001; Tue, 31 Dec 2019 09:47:06 +0000 (GMT) Date: Tue, 31 Dec 2019 09:47:06 +0000 From: Sean Young To: Mauro Carvalho Chehab Cc: "Daniel W. S. Almeida" , 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] media: dvb_dummy_fe: Add error messages in case of attach failure Message-ID: <20191231094706.GD24469@gofer.mess.org> References: <20191107013745.22147-1-dwlsalmeida@gmail.com> <20191130075415.5d7ac0b1@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191130075415.5d7ac0b1@kernel.org> 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 Hi Daniel, Mauro, On Sat, Nov 30, 2019 at 07:54:15AM +0100, Mauro Carvalho Chehab wrote: > Em Wed, 6 Nov 2019 22:37:45 -0300 > "Daniel W. S. Almeida" escreveu: > > > 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 > > Looks OK to me. > > > --- > > 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 4db679cb70ad..ca86857c3667 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; > > } If kzalloc() fails, it will already complain before returning. Lately we've been removing error logs after kmalloc() failures. I'm sure someone will send in patches reverting this if it gets merged. Is this a good idea? Sean > > > > static const struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops; > > @@ -131,12 +135,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; > > } > > > > static const struct dvb_frontend_ops dvb_dummy_fe_qam_ops; > > @@ -148,12 +156,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; > > } > > > > static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = { > > > > Cheers, > Mauro