All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <fengguang.wu@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: sound/pci/hda/hda_hwdep.c:487 parse_hints() warn: inconsistent returns mutex:&codec->user_mutex: locked (478) unlocked (447, 449, 452, 457, 487)
Date: Sat, 12 Jan 2013 10:17:57 +0800	[thread overview]
Message-ID: <20130112021757.GD6150@localhost> (raw)
In-Reply-To: <50f065ed.AKRZpjBAgH1NKCEc%yuanhan.liu@linux.intel.com>


Hi Takashi,

FYI, there are new smatch warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-unstable.git master
head:   02e5aa7b459f69538d4ec88658d064816a7692d6
commit: bea06a147981e88465f566acd6c6e98b297f7712 ALSA: hda - Protect user-defined arrays via mutex
date:   3 hours ago

sound/pci/hda/hda_hwdep.c:487 parse_hints() warn: inconsistent returns mutex:&codec->user_mutex: locked (478) unlocked (447,449,452,457,487)

vim +487 sound/pci/hda/hda_hwdep.c

43b62713 Takashi Iwai       2009-03-02  441  	char *key, *val;
43b62713 Takashi Iwai       2009-03-02  442  	struct hda_hint *hint;
bea06a14 Takashi Iwai       2013-01-10  443  	int err = 0;
1e1be432 Takashi Iwai       2008-07-30  444  
e7d2860b André Goddard Rosa 2009-12-14  445  	buf = skip_spaces(buf);
43b62713 Takashi Iwai       2009-03-02  446  	if (!*buf || *buf == '#' || *buf == '\n')
4ea6fbc8 Takashi Iwai       2009-06-17 @447  		return 0;
43b62713 Takashi Iwai       2009-03-02  448  	if (*buf == '=')
43b62713 Takashi Iwai       2009-03-02 @449  		return -EINVAL;
43b62713 Takashi Iwai       2009-03-02  450  	key = kstrndup_noeol(buf, 1024);
43b62713 Takashi Iwai       2009-03-02  451  	if (!key)
1e1be432 Takashi Iwai       2008-07-30 @452  		return -ENOMEM;
43b62713 Takashi Iwai       2009-03-02  453  	/* extract key and val */
43b62713 Takashi Iwai       2009-03-02  454  	val = strchr(key, '=');
43b62713 Takashi Iwai       2009-03-02  455  	if (!val) {
43b62713 Takashi Iwai       2009-03-02  456  		kfree(key);
43b62713 Takashi Iwai       2009-03-02 @457  		return -EINVAL;
43b62713 Takashi Iwai       2009-03-02  458  	}
43b62713 Takashi Iwai       2009-03-02  459  	*val++ = 0;
e7d2860b André Goddard Rosa 2009-12-14  460  	val = skip_spaces(val);
43b62713 Takashi Iwai       2009-03-02  461  	remove_trail_spaces(key);
43b62713 Takashi Iwai       2009-03-02  462  	remove_trail_spaces(val);
bea06a14 Takashi Iwai       2013-01-10  463  	mutex_lock(&codec->user_mutex);
43b62713 Takashi Iwai       2009-03-02  464  	hint = get_hint(codec, key);
43b62713 Takashi Iwai       2009-03-02  465  	if (hint) {
43b62713 Takashi Iwai       2009-03-02  466  		/* replace */
43b62713 Takashi Iwai       2009-03-02  467  		kfree(hint->key);
43b62713 Takashi Iwai       2009-03-02  468  		hint->key = key;
43b62713 Takashi Iwai       2009-03-02  469  		hint->val = val;
bea06a14 Takashi Iwai       2013-01-10  470  		goto unlock;
43b62713 Takashi Iwai       2009-03-02  471  	}
43b62713 Takashi Iwai       2009-03-02  472  	/* allocate a new hint entry */
43b62713 Takashi Iwai       2009-03-02  473  	if (codec->hints.used >= MAX_HINTS)
43b62713 Takashi Iwai       2009-03-02  474  		hint = NULL;
43b62713 Takashi Iwai       2009-03-02  475  	else
43b62713 Takashi Iwai       2009-03-02  476  		hint = snd_array_new(&codec->hints);
1e1be432 Takashi Iwai       2008-07-30  477  	if (!hint) {
1e1be432 Takashi Iwai       2008-07-30 @478  		return -ENOMEM;
bea06a14 Takashi Iwai       2013-01-10  479  		goto unlock;
1e1be432 Takashi Iwai       2008-07-30  480  	}
43b62713 Takashi Iwai       2009-03-02  481  	hint->key = key;
43b62713 Takashi Iwai       2009-03-02  482  	hint->val = val;
bea06a14 Takashi Iwai       2013-01-10  483   unlock:
bea06a14 Takashi Iwai       2013-01-10  484  	mutex_unlock(&codec->user_mutex);
bea06a14 Takashi Iwai       2013-01-10  485  	if (err)
bea06a14 Takashi Iwai       2013-01-10  486  		kfree(key);
bea06a14 Takashi Iwai       2013-01-10 @487  	return err;
4ea6fbc8 Takashi Iwai       2009-06-17  488  }
4ea6fbc8 Takashi Iwai       2009-06-17  489  
4ea6fbc8 Takashi Iwai       2009-06-17  490  static ssize_t hints_store(struct device *dev,

---
0-DAY kernel build testing backend         Open Source Technology Center
Fengguang Wu, Yuanhan Liu                              Intel Corporation
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

       reply	other threads:[~2013-01-12  2:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <50f065ed.AKRZpjBAgH1NKCEc%yuanhan.liu@linux.intel.com>
2013-01-12  2:17 ` Fengguang Wu [this message]
2013-01-12  7:47   ` sound/pci/hda/hda_hwdep.c:487 parse_hints() warn: inconsistent returns mutex:&codec->user_mutex: locked (478) unlocked (447, 449, 452, 457, 487) Takashi Iwai

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=20130112021757.GD6150@localhost \
    --to=fengguang.wu@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.