From: Paul Menzel Subject: Re: [RFC][PATCH] drm: add helper extracting SADs from EDID Date: Sun, 07 Apr 2013 14:18:47 +0200 Message-ID: <1365337127.7207.31.camel@mattotaupa> References: <1365331977-5622-1-git-send-email-zajec5@gmail.com> <1365335429.7207.25.camel@mattotaupa> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0123200661==" Return-path: Received: from mail.gw90.de (mail.gw90.de [188.40.100.199]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E7EDE5C6C for ; Sun, 7 Apr 2013 05:18:50 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: =?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?= Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0123200661== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-IWFmnJjFpUZhbho38r1K" --=-IWFmnJjFpUZhbho38r1K Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Am Sonntag, den 07.04.2013, 14:11 +0200 schrieb Rafa=C5=82 Mi=C5=82ecki: > Thanks for comments! >=20 > 2013/4/7 Paul Menzel : > > Am Sonntag, den 07.04.2013, 12:52 +0200 schrieb Rafa=C5=82 Mi=C5=82ecki= : > >> +struct cea_sad *drm_edid_to_sad(struct edid *edid) > >> +{ > >> + struct cea_sad *sads =3D NULL; > > > > No need to set it NULL, as it gets assigned later on? Looks like in the > > end there is a corner case, where nothing gets assigned in the > > `for_each_cea_db` loop. So the compiler is going to complain. >=20 > Right, I can drop that. Curious, my gcc didn't complain. Oh, I did not check with GCC. But there is that corner case, if I am not mistaken. > >> + if (cea_revision(cea) < 3) { > >> + DRM_DEBUG_KMS("SAD: wrong CEA revision\n"); > >> + return NULL; > >> + } > >> + > >> + if (cea_db_offsets(cea, &start, &end)) { > >> + DRM_DEBUG_KMS("SAD: invalid data block offsets\n"); > >> + return NULL; > >> + } > > > > Could the above be put in some helper too: > > `is_cea_valid_for_version(cea, version)`? >=20 > Not sure if it's worth a helper. But maybe I'll go and just use a single = check? > if (cea_revision(cea) < 3 || cea_db_offsets(...)) I kind of like the useful error messages, you put there. So if no helper, then I=E2=80=99d prefer if you leave it as is. > >> + for_each_cea_db(cea, i, start, end) { > >> + db =3D &cea[i]; > >> + dbl =3D cea_db_payload_len(db); > >> + > >> + if (cea_db_tag(db) =3D=3D AUDIO_BLOCK) { > >> + int count =3D dbl / 3; /* SAD is 3B */ > >> + int j; > >> + > >> + sads =3D kzalloc(count + 1 * sizeof(*sads), GFP_= KERNEL); > >> + if (!sads) > > > > Add an error too? =C2=BBkzallac failed=C2=AB or something like this? >=20 > Allocation failures are aloud enough on the lower level. I was > corrected few times already to don't put warnings when alloc fails. If > you want me to point to the discussions, I'll have to search though. No need. I believe you. > >> +#define SAD_FORMAT_LPCM 0x01 > >> +#define SAD_FORMAT_AC3 0x02 > > > > At least in my MUA indentation looks different. >=20 > It's just a matter of .patch format. Patch file has "+" sign at a > beginning of line and \t can look different when viewing patch. Please > apply a patch and check drm_edid.h then - it'll be OK. Thanks. Sorry for not checking that myself. Thanks, paul --=-IWFmnJjFpUZhbho38r1K Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEABECAAYFAlFhZCcACgkQPX1aK2wOHVgloACdF40VXU/tDCKHhajtG+g5Mv8N mQMAn2m6y9HMmdJg7p0SUFDgPcfmqlm4 =lCNz -----END PGP SIGNATURE----- --=-IWFmnJjFpUZhbho38r1K-- --===============0123200661== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0123200661==--