From: Sean Young <sean@mess.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>,
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
Date: Tue, 31 Dec 2019 09:47:06 +0000 [thread overview]
Message-ID: <20191231094706.GD24469@gofer.mess.org> (raw)
In-Reply-To: <20191130075415.5d7ac0b1@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" <dwlsalmeida@gmail.com> escreveu:
>
> > From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
> >
> > Complain if the attach functions fail, for any reason. This is helpful
> > when debugging.
> >
> > Suggested-by: Shuah Khan <skhan@linuxfoundation.org>
> > Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
>
> 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
prev parent reply other threads:[~2019-12-31 9:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-07 1:37 [PATCH] media: dvb_dummy_fe: Add error messages in case of attach failure Daniel W. S. Almeida
2019-11-30 6:54 ` Mauro Carvalho Chehab
2019-12-31 9:47 ` Sean Young [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191231094706.GD24469@gofer.mess.org \
--to=sean@mess.org \
--cc=dwlsalmeida@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rfontana@redhat.com \
--cc=skhan@linuxfoundation.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).