Skip to content

Commit

Permalink
[media] media: venus: hfi_cmds: fix variable dereferenced before check
Browse files Browse the repository at this point in the history
This fixes a warning found when building the driver with gcc7:

drivers/media/platform/qcom/venus/hfi_cmds.c:415
pkt_session_set_property_1x() warn: variable dereferenced before
check 'pkt' (see line 412)
drivers/media/platform/qcom/venus/hfi_cmds.c:1177
pkt_session_set_property_3xx() warn: variable dereferenced before
check 'pkt' (see line 1174)

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
  • Loading branch information
Stanimir Varbanov authored and Mauro Carvalho Chehab committed Jun 20, 2017
1 parent 8a5aebf commit 2b2e648
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/media/platform/qcom/venus/hfi_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,14 @@ static int pkt_session_get_property_1x(struct hfi_session_get_property_pkt *pkt,
static int pkt_session_set_property_1x(struct hfi_session_set_property_pkt *pkt,
void *cookie, u32 ptype, void *pdata)
{
void *prop_data = &pkt->data[1];
void *prop_data;
int ret = 0;

if (!pkt || !cookie || !pdata)
return -EINVAL;

prop_data = &pkt->data[1];

pkt->shdr.hdr.size = sizeof(*pkt);
pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY;
pkt->shdr.session_id = hash32_ptr(cookie);
Expand Down Expand Up @@ -1171,12 +1173,14 @@ static int
pkt_session_set_property_3xx(struct hfi_session_set_property_pkt *pkt,
void *cookie, u32 ptype, void *pdata)
{
void *prop_data = &pkt->data[1];
void *prop_data;
int ret = 0;

if (!pkt || !cookie || !pdata)
return -EINVAL;

prop_data = &pkt->data[1];

pkt->shdr.hdr.size = sizeof(*pkt);
pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY;
pkt->shdr.session_id = hash32_ptr(cookie);
Expand Down

0 comments on commit 2b2e648

Please sign in to comment.