<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Agreed that if you fail on 10 bytes the OOM monster is probably being woken up soon.  Unless it's performance issue it doesn't hurt to add a check and return a code (if possible in this function since it returns flags not a pointer/int).</p>
<p><br>
</p>
<p>Tom</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Michel Dänzer <michel@daenzer.net><br>
<b>Sent:</b> Wednesday, June 8, 2016 10:43<br>
<b>To:</b> StDenis, Tom<br>
<b>Cc:</b> xorg-driver-ati@lists.x.org; Yu, Qiang<br>
<b>Subject:</b> Re: [PATCH xf86-video-amdgpu 3/6] Add amdgpu_pixmap_get_tiling_info</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On 08.06.2016 22:57, StDenis, Tom wrote:<br>
> From: Michel Dänzer <michel@daenzer.net><br>
>  <br>
>> +uint64_t amdgpu_pixmap_get_tiling_info(PixmapPtr pixmap)<br>
>> +{<br>
>> +       struct amdgpu_pixmap *priv = amdgpu_get_pixmap_private(pixmap);<br>
>> +       uint32_t handle;<br>
>> +<br>
>> +       if (!priv || !priv->handle_valid) {<br>
>> +               amdgpu_pixmap_get_handle(pixmap, &handle);<br>
>> +               priv = amdgpu_get_pixmap_private(pixmap);<br>
> <br>
> If this fails won't you just end up with a NULL pointer?<br>
<br>
Yes, but if calloc fails for tens of bytes, that's probably one of our<br>
lesser concerns. :) In particular, in that case we'd already crash in<br>
amdgpu_pixmap_get_handle before we get back here.<br>
<br>
<br>
-- <br>
Earthling Michel Dänzer               |               <a href="http://www.amd.com" id="LPlnk212621">
http://www.amd.com</a>
<div id="LPBorder_GT_14653978567860.7954484916650637" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_14653978567840.0038129852356754146" cellspacing="0" style="width: 90%; position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top-width: 1px; border-top-style: dotted; border-top-color: rgb(200, 200, 200); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(200, 200, 200); background-color: rgb(255, 255, 255);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_14653978567850.014790148455221974" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_14653978567850.3180224523268387"></div>
<div id="LPTitle_14653978567850.8549763549073082" style="top: 0px; color: rgb(59, 87, 119); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_14653978567850.8796414572129538" href="http://www.amd.com/" target="_blank" style="text-decoration: none;">Graphics, Processors and Immersive VR Solutions | AMD
</a></div>
<div id="LPMetadata_14653978567850.1979499235395683" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
www.amd.com</div>
<div id="LPDescription_14653978567860.14198084785550424" style="display: block; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
Explore a wide range of innovative next generation computing processors, graphics, and Immersive VR solutions by Advanced Micro Devices (AMD). Visit AMD.com now!</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
Libre software enthusiast             |             Mesa and X developer<br>
</div>
</span></font></div>
</div>
</body>
</html>