From: Dan Carpenter <dan.carpenter@oracle.com>
To: tobias.johannes.klausmann@mni.thm.de
Cc: linux-media@vger.kernel.org
Subject: [bug report] media: stv090x: Implement probe/remove for stv090x
Date: Tue, 18 Jun 2019 13:53:14 +0300 [thread overview]
Message-ID: <20190618105314.GA8418@mwanda> (raw)
Hello Tobias Klausmann,
The patch eb5005df886b: "media: stv090x: Implement probe/remove for
stv090x" from May 29, 2019, leads to the following static checker
warning:
drivers/media/dvb-frontends/stv090x.c:5032 stv090x_probe()
warn: 'state' was already freed.
drivers/media/dvb-frontends/stv090x.c
4994 static int stv090x_probe(struct i2c_client *client,
4995 const struct i2c_device_id *id)
4996 {
4997 int ret = 0;
4998 struct stv090x_config *config = client->dev.platform_data;
4999
5000 struct stv090x_state *state = NULL;
5001
5002 state = kzalloc(sizeof(*state), GFP_KERNEL);
5003 if (!state) {
5004 ret = -ENOMEM;
5005 goto error;
5006 }
5007
5008 state->verbose = &verbose;
5009 state->config = config;
5010 state->i2c = client->adapter;
5011 state->frontend.ops = stv090x_ops;
5012 state->frontend.demodulator_priv = state;
5013 state->demod = config->demod;
5014 /* Single or Dual mode */
5015 state->demod_mode = config->demod_mode;
5016 state->device = config->device;
5017 /* default */
5018 state->rolloff = STV090x_RO_35;
5019
5020 ret = stv090x_setup_compound(state);
5021 if (ret)
5022 goto error;
stv090x_setup_compound() frees "state" on error.
5023
5024 i2c_set_clientdata(client, state);
5025
5026 /* setup callbacks */
5027 config->get_dvb_frontend = stv090x_get_dvb_frontend;
5028
5029 return 0;
5030
5031 error:
5032 kfree(state);
^^^^^^^^^^^^
Double free.
5033 return ret;
5034 }
regards,
dan carpenter
next reply other threads:[~2019-06-18 10:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 10:53 Dan Carpenter [this message]
2019-06-18 11:29 ` [bug report] media: stv090x: Implement probe/remove for stv090x Tobias Klausmann
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=20190618105314.GA8418@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-media@vger.kernel.org \
--cc=tobias.johannes.klausmann@mni.thm.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