[Mesa-dev] [PATCH 4/5] nv50: check return value of nouveau_object_new()
Samuel Pitoiset
samuel.pitoiset at gmail.com
Mon Dec 14 08:04:35 PST 2015
On 12/14/2015 04:05 PM, Ilia Mirkin wrote:
> Bogus. obj will be null on failure.
Well, checking the return value instead of obj seems better tbh, because
we do that in the rest of the code.
>
> On Mon, Dec 14, 2015 at 5:14 AM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> Spotted by Coverity.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>> src/gallium/drivers/nouveau/nv50/nv84_video.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv84_video.c b/src/gallium/drivers/nouveau/nv50/nv84_video.c
>> index 7a4670f..5e2489a 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv84_video.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv84_video.c
>> @@ -756,8 +756,8 @@ firmware_present(struct pipe_screen *pscreen, enum pipe_video_format codec)
>> int present, ret;
>>
>> if (!FIRMWARE_PRESENT(checked, VP_KERN)) {
>> - nouveau_object_new(screen->channel, 0, 0x7476, NULL, 0, &obj);
>> - if (obj)
>> + ret = nouveau_object_new(screen->channel, 0, 0x7476, NULL, 0, &obj);
>> + if (!ret && obj)
>> screen->firmware_info.profiles_present |= FIRMWARE_VP_KERN;
>> nouveau_object_del(&obj);
>> screen->firmware_info.profiles_checked |= FIRMWARE_VP_KERN;
>> @@ -765,8 +765,8 @@ firmware_present(struct pipe_screen *pscreen, enum pipe_video_format codec)
>>
>> if (codec == PIPE_VIDEO_FORMAT_MPEG4_AVC) {
>> if (!FIRMWARE_PRESENT(checked, BSP_KERN)) {
>> - nouveau_object_new(screen->channel, 0, 0x74b0, NULL, 0, &obj);
>> - if (obj)
>> + ret = nouveau_object_new(screen->channel, 0, 0x74b0, NULL, 0, &obj);
>> + if (!ret && obj)
>> screen->firmware_info.profiles_present |= FIRMWARE_BSP_KERN;
>> nouveau_object_del(&obj);
>> screen->firmware_info.profiles_checked |= FIRMWARE_BSP_KERN;
>> --
>> 2.6.4
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
--
-Samuel
More information about the mesa-dev
mailing list