linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: J.Lambrecht@TELEVIC.com (Lambrecht Jürgen)
To: linux-arm-kernel@lists.infradead.org
Subject: unsigned int 'return -1' in /sound/soc/codecs/tlv320aic23.c
Date: Fri, 17 Jun 2011 14:13:04 +0200	[thread overview]
Message-ID: <4DFB44D0.4080306@televic.com> (raw)

Hello,

I see this error in /sound/soc/codecs/tlv320aic23.c:

static inline unsigned int tlv320aic23_read_reg_cache(struct snd_soc_codec
               ^^^^^^^^
                               *codec, unsigned int reg)
{
     u16 *cache = codec->reg_cache;
     if (reg >= ARRAY_SIZE(tlv320aic23_reg))
         return -1;
                ^^
     return cache[reg];
}

Maybe better return 0?
Best read the codec datasheet to find a safe or non-existing value?
And also a "printk(KERN_ERR " then?
Actually, better just remove the check, because if you want to write a 
codec register, you must know what you are doing?

I am busy with the codec driver for mc13783.
Currently, the mc13783 (from Sascha Hauer) code does not check 'reg'.

(I want to supply a patch finally, but as newbie: from which GIT?, 
because mine is a merge of 2 branches of the Pengutronix GIT)

Regards,
J?rgen

-- 
J?rgen Lambrecht
R&D Associate
Tel: +32 (0)51 303045    Fax: +32 (0)51 310670
http://www.televic-rail.com
Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium
Company number 0825.539.581 - RPR Kortrijk

                 reply	other threads:[~2011-06-17 12:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4DFB44D0.4080306@televic.com \
    --to=j.lambrecht@televic.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).