Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/edid: use a temp variable for sads to drop one level of dereferences

Use a temporary variable struct cea_sad *, instead of using struct
cea_sad ** directly with the double dereferences. It's arguably easier
on the eyes, and drops a set of parenthesis too.

Cc: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Reviewed-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b6e2f295ae5491c2bb0f528508f0f5fca921dc77.1698747331.git.jani.nikula@intel.com

+9 -7
+9 -7
drivers/gpu/drm/drm_edid.c
··· 5591 5591 } 5592 5592 5593 5593 static int _drm_edid_to_sad(const struct drm_edid *drm_edid, 5594 - struct cea_sad **sads) 5594 + struct cea_sad **psads) 5595 5595 { 5596 5596 const struct cea_db *db; 5597 5597 struct cea_db_iter iter; ··· 5600 5600 cea_db_iter_edid_begin(drm_edid, &iter); 5601 5601 cea_db_iter_for_each(db, &iter) { 5602 5602 if (cea_db_tag(db) == CTA_DB_AUDIO) { 5603 + struct cea_sad *sads; 5603 5604 int j; 5604 5605 5605 5606 count = cea_db_payload_len(db) / 3; /* SAD is 3B */ 5606 - *sads = kcalloc(count, sizeof(**sads), GFP_KERNEL); 5607 - if (!*sads) 5607 + sads = kcalloc(count, sizeof(*sads), GFP_KERNEL); 5608 + *psads = sads; 5609 + if (!sads) 5608 5610 return -ENOMEM; 5609 5611 for (j = 0; j < count; j++) { 5610 5612 const u8 *sad = &db->data[j * 3]; 5611 5613 5612 - (*sads)[j].format = (sad[0] & 0x78) >> 3; 5613 - (*sads)[j].channels = sad[0] & 0x7; 5614 - (*sads)[j].freq = sad[1] & 0x7F; 5615 - (*sads)[j].byte2 = sad[2]; 5614 + sads[j].format = (sad[0] & 0x78) >> 3; 5615 + sads[j].channels = sad[0] & 0x7; 5616 + sads[j].freq = sad[1] & 0x7F; 5617 + sads[j].byte2 = sad[2]; 5616 5618 } 5617 5619 break; 5618 5620 }