* [PATCH] ASoC: hdac_hdmi: remove always false condition
@ 2015-11-24 11:12 Sudip Mukherjee
2015-11-25 12:36 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2015-11-24 11:12 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: linux-kernel, alsa-devel, Sudip Mukherjee
hdac->num_nodes is unsigned int and can never be less than 0.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
Or, maybe, another way can be to declare num_nodes as int. Then this
test makes sense and also snd_hdac_get_sub_nodes() is returning an int.
sound/soc/codecs/hdac_hdmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 205f2c2..02109aa 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -415,7 +415,7 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev)
int cvt_nid = 0, pin_nid = 0;
hdac->num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid);
- if (!nid || hdac->num_nodes < 0) {
+ if (!nid) {
dev_warn(&hdac->dev, "HDMI: failed to get afg sub nodes\n");
return -EINVAL;
}
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: hdac_hdmi: remove always false condition
2015-11-24 11:12 [PATCH] ASoC: hdac_hdmi: remove always false condition Sudip Mukherjee
@ 2015-11-25 12:36 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-11-25 12:36 UTC (permalink / raw)
To: Sudip Mukherjee
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-kernel, alsa-devel
[-- Attachment #1: Type: text/plain, Size: 493 bytes --]
On Tue, Nov 24, 2015 at 04:42:26PM +0530, Sudip Mukherjee wrote:
> hdac->num_nodes is unsigned int and can never be less than 0.
> Or, maybe, another way can be to declare num_nodes as int. Then this
> test makes sense and also snd_hdac_get_sub_nodes() is returning an int.
Yes, that's a better fix:
> hdac->num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid);
> - if (!nid || hdac->num_nodes < 0) {
> + if (!nid) {
it's clear that we're looking for an error code on failure here.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-25 12:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-24 11:12 [PATCH] ASoC: hdac_hdmi: remove always false condition Sudip Mukherjee
2015-11-25 12:36 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®