From patchwork Tue Jul 18 09:50:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 121929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1632950vqt; Tue, 18 Jul 2023 03:11:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlHDPq3AK401dVTmabfK15PlNg5nZvpKY4SVVyt0UEHOIbzM92M19Bd1F43iC+T57Mx54doV X-Received: by 2002:a05:6402:332:b0:51e:1a3e:1a6 with SMTP id q18-20020a056402033200b0051e1a3e01a6mr14909915edw.20.1689675110591; Tue, 18 Jul 2023 03:11:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689675110; cv=pass; d=google.com; s=arc-20160816; b=v89MJRrfee+XQUffvL7fjsTUAiek7WZ1ka3gTIiAKnaV1HKKUHBQTdFrnobL+G/PVF CJUl2aO6ozoepi38NBq6tcF1Xdbs7snJvkzABNm6mQSS3l141MM57q2R8mdfpQJsR1zg ZoFcIME95V6WLBpPoDcHtNR/13LNnaQn5oPojdui4PRIKnV3m+cHrEOpzPun+HoTDaiu 4sxQ13stWD0hvIFYnaPrGv4tS0WMLtk8x6vva+siQWYlh8gX7pZ7ursmMSoweIo2d/MQ 1GyhCZ8ZCTzD89vZFVsMQUK5jvE1c75LKEsZz36lbYfs9vwu7x3fH8f8/YXzrfccZTqf BJIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=enSYVrFfIT24FN10A6OY5c9XnXIhLz6/pInfzdHOsoA=; fh=GAC17AFk4Pml4KicrhQSrAcjdb11ws2HmGr+fDle9es=; b=eyidNYp2SR3TB4/UM+CuWb2Jo4c7wqWZ8sCeFT7eBHA47L4gujxlEeiz/yO//oGkzJ SfRlvjMhP+E6bvLdAi4JsA9LhsxEIWL/XjM6z/cK9bR+hG+nr8ESLiIYqFO7iq5i+uAB ++QgDkZ8d77Iddx5GCAw6pxoDTMbB0NwMiB0+MGuj8JKn6TCwe+BsVWTkHdK/C6Xnn3/ Y3YCD19PhuvNmz7HQnGpciRLEzr70TEtExSuh9hM+3c78PGOAhnXpcTKo8mUV2YXQR7i DKGTsgOV/ruzAQsTdqrXT9p+VtbwFbJbJH4/DwWGQdhqG26AEc9sZAB9ruQ/HCGz9sVg U0zA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=QNxnk3Gm; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020aa7d1cc000000b0051e1644fd3dsi959703edp.635.2023.07.18.03.11.26; Tue, 18 Jul 2023 03:11:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=QNxnk3Gm; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232125AbjGRJvF (ORCPT + 99 others); Tue, 18 Jul 2023 05:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231948AbjGRJuu (ORCPT ); Tue, 18 Jul 2023 05:50:50 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2045.outbound.protection.outlook.com [40.107.14.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76EAFFB; Tue, 18 Jul 2023 02:50:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yi+TA9at+4Esd8r2NYuwPhBLfl+BhcJJ8fG1P1lK484Z3VB3k2doL8qYzBW8ZY1+jBqNJ5MS9Ygy8ElcDI77PcJb2q1qG5Zrzu5lFZGYq7QuJukc6LMMA5x5b5C099agEHN1Ss/0NYU3sADLjSt5c2UejHPPB6j/6ZJycU9reRtMK7fxOcNyLpSyPvqowhAVd73zqanpGnBqhDgZkCWf7YyP78oaoJRNh2UPQ4zP54V/P+wiHLN3J1Ov3RtDPJIh1EpPErF1FUfcZGDzjHCZnxhTxEQ2hC7WY6ySemWQwgmk/+8w8KCz49PNPORWJqvM9WPAQ5JM3OfIZgnrNbNFVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=enSYVrFfIT24FN10A6OY5c9XnXIhLz6/pInfzdHOsoA=; b=bbCainN0qJJ74s/FquaJUIHIhCXU5VhbOKuxNgVG1eF19xzV8LLUuP+T3g/uwGcEaRlHBX/dI0s2HAzZrF1PXx1rJNLUOESc9+xLbKoTPKdRRqko9Xc7ruh3zBsQffiNFOZ5czQ91lb6hCQlwtmwyuoQwR2s/kQCjLDoXvfjdpLfsgBuJAgLMPlpeUEzbIjrsPYiT+cl2a4EMwp2oFotG0SbPZgQ5MWu5r7F16vkBwBdEPobr4kaSCzSzf78uAueV4YEOPWg5TsV+BhacJP4MUkGTRZzR4Jkh6qL2k0emyGX43w/JSQtPDX3I8LRlWfDVIkgHd0hWd5lGIHeDIHsPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=enSYVrFfIT24FN10A6OY5c9XnXIhLz6/pInfzdHOsoA=; b=QNxnk3Gmt+iOzl45V2Nv6yORJSP57RIi9PLVvg2wm4mx6fiJ0eqLBMPeW8vZ9qf1Rdrz2vJrLCfxZhzydqrWfSkNlZD0xW7fVqWsnfWR25DpkIOeqjN8UQv7Yep2/k3swoPAN8nQ4Z+VdVrceexmR6VWxhLlwyj+c2+NFeAFuz8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by DB8PR04MB7067.eurprd04.prod.outlook.com (2603:10a6:10:12a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Tue, 18 Jul 2023 09:50:46 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a%5]) with mapi id 15.20.6588.031; Tue, 18 Jul 2023 09:50:46 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/5] media: amphion: fix CHECKED_RETURN issues reported by coverity Date: Tue, 18 Jul 2023 17:50:09 +0800 Message-Id: <6df1c8bb1d85543d131e09408581b59842bb02d9.1689673395.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:4:197::8) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB8PR04MB7067:EE_ X-MS-Office365-Filtering-Correlation-Id: 026c5c93-ecd0-434c-100e-08db87747592 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CfamIPAQK9vBEc2hbinDiCj/3KSZHJspPvG2Zg0pXx7vDev3WWQhm+HKWTynrZjUYz7zWQCVJxEztZBD2tkT0Trp/TWico0LdhPs126ti1H/+aNCbaeVhEyDxMCoDIN5XvAzNfFIxNYCm5vtu/u3nr8QTavbOEGXkMHBjC+BGl++wum4Mkk7EyXSON5/BNvGK+w4SxNxaZ5am7W6gzWDkIpwjcpoGFzRTkRbf1RWKoAhL70e5sFfvDsfoa1ituFtB0hPQyhaO4ObFxKc0+np0G4xTXgygtHMXdHTqE1PkOlAy+LaNuAJHG/SFn8LZJvrcIWccw41XwSfI5UF51YIYfg3tk7JhdSBrdSaA70WV2/5u7Gvx7xSDGP5FRTv9Jb/SHhdOss3Sz1K51DXk3Pbxlqg6RcveoeVfWaoO8ALJfikgShMz5O8DciCsHiLkAsyhrHIJflNP4Heoqm2rYqUIhgLizvLeUP+NzVJZoR9osuYbppWdlKmrUtO3XDilh5JsD4796sOZFz7GQGn1LrH7FVGeFoH4dzfedo0neB2OE/B6yaMQmDV64H3qz59rvYjdirdK0c+5t/5RTgz3JFt7WZmxeE3AbIMdAK69VrdlQqdt4fd2v7XI9rzyt4GMqgI X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(376002)(39860400002)(136003)(346002)(396003)(451199021)(7416002)(86362001)(2906002)(36756003)(44832011)(2616005)(6512007)(83380400001)(186003)(6506007)(26005)(38350700002)(38100700002)(52116002)(6486002)(6666004)(4326008)(66946007)(66476007)(66556008)(316002)(5660300002)(478600001)(8676002)(41300700001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /NvyqlpVRmW7SeEo6RUe17WAkzNLsm+4gTigXFGuRTzRVDozCpUsCHcK1Zzrp7TpW0U89mhpWWg51oga6zb/Qk6CyUzMHr6xtfPHq/miNX1Hr7F/xUO1vSRnfjk2zfl3mvLUuuVZi918Dk8iRX2FqfSVf0Oph/qf3ufHAyjHcIoT73vR/5Q5scaCuiqfmPyMMt096somPjqpPUMEbkaW79SavciozneLWyAnM44/fLtZyV0i8coyLDdeF7DbPq3rUgnQ6tx81dqhZMt+zh4IDO9QjY1PAzPVaJ6rfh0Kf8wTamLKXJ1bC5SAWmxAuDwOI059S+0A8+9gpAHfyDgYTe/yBDBOez/b18wAYM46pHytE6CgxnPNjqv+UiiHc4mL9J7ML2J0mrnF7hEPciRwVkjOJpvXOhRXBeA4DK/m5s3LKb+3YyjIXvJCHcDvyBdOAvcRrnGUHw8JQDXtyF367q8fImIBFaFaVWLhNzqxwacFUyHY2dXollVOAJC5/J5/BL+WM7V9TmJro214OJ4pf1IcvRxRdbM7GIBANKyx31wVaqb+lxkHOUclEwteNCGCbFq1j0vQa44WKyppGRJZmO3VWW4Aydjckru2oPBLlrkSYbzWOAACkePFvXSMY1zsnkY0n8moIlMp270MEQrU0Mzveighx/n901ZEW7qy0sKddnQKvQNbf7VmTRRs6gmqwFQXQ4pxBLHiEEGkUPEciArLIUff6Kd/0XDyVKMo6k975kQ7l44D6zSpgK9FYSnVJzdAYt32HKC/EqE9Nd28DvqiyWv98uJNEmUPToliOaFgjpbuXIT1XaQy5FkkQmPLM0XTk2Xgl3z8e+XAHnYkcpvSJk+j8pOxGSw1Y2iB5xWHEAB8ojilVdXmcrS8zBunM0bzxkPa4/JLDexGsLyT9ZJTfq+M5hcD/LyOcL1CRyUqSN/7gCYWMqcBb93csO0CoRx6b08QMWCOXMsYrDP7fUJCKTDF/RlhZ+FE/T87XxEw9zZI6zq1E52v/CJsgmwPqJ66AuygXT/w8OkNX6QuTHCWhFztLZN8wYFUzjhX0TJPnH6MfUshCzGWhcatyqnwZPNJv68AAduolb0Ey+T1wPm8yusxOV2N7rj/r9KYtxBzqg7F+035eyb7kYsrLdheZmuYxVD1AL8Subl4OAunHwX/60O83Cq1DeeVRTCr8Aile1JHozMmrqzfhGlZBynZMhl1ODVKe9iqclyzQ/n0hGic1TINcpi/GN9dxKjWpJ3gBH+Q9N3qZWVEhMA19RVsmuOcNy0Wt3yDSh5zwxINkDYSswbxVQa+Z9tnv/6k9P1ZYiiRIsAfgvR9Q4mJQuGyBrYv2b1SAbAQKEGBjXKOPRdwdX8bpSfGMekg6rus5508Gg6etoFi2ehfu1z/7oCiq+EIi3TTG3WaE8JHrbzWrRa/uvyqkokHl8qx3bQRpioR0yme4cZeGkEQMkmh/Q7aD89GIOtzre6tIbHb5iWB5D3NwRVqphMVlaMzbYldNa+5+HsT4TV3qlF9lq3I/1sCsz9dvjFReqH8njAHHG9Fi5lD9kU7fbf9EpbXAD3+To8xUqO7oianZiLIaEF6VsuA X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 026c5c93-ecd0-434c-100e-08db87747592 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 09:50:46.5244 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BneUr227W6Q/jBF2dTeAz4nn5tTBfLjlQa0iGR+FJp/PUs+nBY/fhUf0WJVMuwJjjvhQrsqGf7yIyQHA1w3b+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7067 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771752768661755811 X-GMAIL-MSGID: 1771752768661755811 calling "vpu_cmd_send/vpu_get_buffer_state/vpu_session_alloc_fs" without checking return value Fixes: 9f599f351e86 ("media: amphion: add vpu core driver") Reviewed-by: Nicolas Dufresne Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vdec.c | 5 ++++- drivers/media/platform/amphion/vpu_cmds.c | 3 ++- drivers/media/platform/amphion/vpu_dbg.c | 11 +++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index eeb2ef72df5b..133d77d1ea0c 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -1019,6 +1019,7 @@ static int vdec_response_frame_abnormal(struct vpu_inst *inst) { struct vdec_t *vdec = inst->priv; struct vpu_fs_info info; + int ret; if (!vdec->req_frame_count) return 0; @@ -1026,7 +1027,9 @@ static int vdec_response_frame_abnormal(struct vpu_inst *inst) memset(&info, 0, sizeof(info)); info.type = MEM_RES_FRAME; info.tag = vdec->seq_tag + 0xf0; - vpu_session_alloc_fs(inst, &info); + ret = vpu_session_alloc_fs(inst, &info); + if (ret) + return ret; vdec->req_frame_count--; return 0; diff --git a/drivers/media/platform/amphion/vpu_cmds.c b/drivers/media/platform/amphion/vpu_cmds.c index 647d94554fb5..7e137f276c3b 100644 --- a/drivers/media/platform/amphion/vpu_cmds.c +++ b/drivers/media/platform/amphion/vpu_cmds.c @@ -306,7 +306,8 @@ static void vpu_core_keep_active(struct vpu_core *core) dev_dbg(core->dev, "try to wake up\n"); mutex_lock(&core->cmd_lock); - vpu_cmd_send(core, &pkt); + if (vpu_cmd_send(core, &pkt)) + dev_err(core->dev, "fail to keep active\n"); mutex_unlock(&core->cmd_lock); } diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c index adc523b95061..982c2c777484 100644 --- a/drivers/media/platform/amphion/vpu_dbg.c +++ b/drivers/media/platform/amphion/vpu_dbg.c @@ -50,6 +50,13 @@ static char *vpu_stat_name[] = { [VPU_BUF_STATE_ERROR] = "error", }; +static inline const char *to_vpu_stat_name(int state) +{ + if (state <= VPU_BUF_STATE_ERROR) + return vpu_stat_name[state]; + return "unknown"; +} + static int vpu_dbg_instance(struct seq_file *s, void *data) { struct vpu_inst *inst = s->private; @@ -141,7 +148,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) num = scnprintf(str, sizeof(str), "output [%2d] state = %10s, %8s\n", i, vb2_stat_name[vb->state], - vpu_stat_name[vpu_get_buffer_state(vbuf)]); + to_vpu_stat_name(vpu_get_buffer_state(vbuf))); if (seq_write(s, str, num)) return 0; } @@ -156,7 +163,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) num = scnprintf(str, sizeof(str), "capture[%2d] state = %10s, %8s\n", i, vb2_stat_name[vb->state], - vpu_stat_name[vpu_get_buffer_state(vbuf)]); + to_vpu_stat_name(vpu_get_buffer_state(vbuf))); if (seq_write(s, str, num)) return 0; } From patchwork Tue Jul 18 09:50:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 121923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1624515vqt; Tue, 18 Jul 2023 02:56:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlENuCsfjd6/IS5D6IaVotY8hFtYE2zYRn2qvvkqzJONNPGVjrPdXuEuxf3IxxbmOvvxll0k X-Received: by 2002:a05:6a21:78a7:b0:117:3c00:77ea with SMTP id bf39-20020a056a2178a700b001173c0077eamr16177589pzc.0.1689674160936; Tue, 18 Jul 2023 02:56:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689674160; cv=pass; d=google.com; s=arc-20160816; b=cHaiM1q9q5nh+Z51evY1AbA0l+MB395AtetYeWXi0FBlwyQwPD/aTJOKMicUHco+Yw Gbo1AE/q3MRUuIgwbYr14L2+hQ58SwYfryDUGHJgBCNmLMJD/8MUV7H/H/4HxIoXoHIv ADmQwLQsd6J+p9lihMYCdj4vunAPwVsD0BehNtmMYQ7zg0BAUEI1xdI4FRM8Xxh4vOLG hC/RriXokHidnj6yuJOvDk5pKLzDPeazNhCh3jwBxDH3J5Vlg8SV6Xc4lTB4LSqooyap 0ElWSz6iaFbe5RmcO9x4o+JvGiqtZpVONGA+eXNYNHCg9enIisuPgchj4r6G4l3zLeXz 8ePw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XMPSaVrTk90sPU+BiEdPKlljJs+HqKRNWWBHYcWnATM=; fh=GAC17AFk4Pml4KicrhQSrAcjdb11ws2HmGr+fDle9es=; b=PE95X1A7aPZMmHmkJRLFIKONmzg5fK7NsbKC6brELIrhIHvDykn+vxMUKOQlVIZyDv /u1UdRSUUB4gphIcyBW/0zi5Iv4t8K0/nFbKnG6iCNrG1Y7RG2Rxe+LzZITPxBr9WC6P 10PeTdIFZF3spF35N/ggEEkDjf1GrmHgNRcRyL0BQrQAKMI1HC1dz6N6c/wryCRnrSiq 6GWWAwZLY8PfP0HLCEYt/9cRLO7VttotbBX+4RuWLkIyhgkhoREqUf3K6u3B6/ClswFK 6yQ2oymldrta1gWIHP3/mEjTzl334h+qE6O5z2L1v3P6NmheRAhxomQAuMu2b+8uN484 U0FA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=XNBExj3b; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j23-20020a635517000000b0055bc2561b6esi1313256pgb.673.2023.07.18.02.55.47; Tue, 18 Jul 2023 02:56:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=XNBExj3b; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232201AbjGRJvH (ORCPT + 99 others); Tue, 18 Jul 2023 05:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232008AbjGRJuy (ORCPT ); Tue, 18 Jul 2023 05:50:54 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2082.outbound.protection.outlook.com [40.107.7.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B60B128; Tue, 18 Jul 2023 02:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f4txJXoxhh/9Ppywwse6QlGvgwj5xnCdG0J9eRpTm+agbr3ARbqn+NGeod/M9DZu90MNJlEntRkyQWlzrUl3QVMXIsNEkmiYEq3dgG4+ZVVRh2WGB3+ZC7v9SqpM+fwBD7NAGa6lMMPQYjazcMfLR3I8Kw5Dk304vvpwdasQdPLuic59xCKM5Lti/OYDyRNc1xVvIfe22J2qP+HxKK8OxjBwtFlYGJ5UcffnfuM29k68f2KeA+CUQsdMvZqHQtcdFvZj5TIyR4FMdi5YgrWDc4AmasF5ypCz4MvzFga5MJOhnpo0cuPpfsAmL64g2k3zjMPlLlZuHKS37yUPqaM6Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XMPSaVrTk90sPU+BiEdPKlljJs+HqKRNWWBHYcWnATM=; b=EGdLcyF5Xf8oNB/mgvbIvH2x9UPypSqyLFsm2OYW2/EmSTdPZZmqC2pw9Fe5JdRNPn+P7r4mG1pSW1Iu+nJg+xMcqFbj1k+ohcvMiDq/R8oQ3dBfZCnrJJz6Unqj68e1xpPPhJ38ZAoKiyWhEmMtVvCvYpovO/ceb5epKmnUvajDumJrjStdoRRWa9dWJ/iGqOfkDckmSjc56c2QVCzM6DyimnL9S5Ud1jK3yowEFZfobVF5P9567U6DsKmEvBbooYko3OVTv9YNMTiwf1fkoWGGvJbKqrEs9jAwelBRbqH5LlM4dYV4Tl4WfHGV7zt+PjXIe9LsQgKz7f9DDl70kg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XMPSaVrTk90sPU+BiEdPKlljJs+HqKRNWWBHYcWnATM=; b=XNBExj3bcW0mHsYELRQi45CF6+5RL9WKqUt+wFtlQzxRiSOq+Tgh5Lelzo8pFzM3Rq3niKGCMmfv5+tbAwK6NUlUyQiihDhM3lm0dzCFiBZuOqb7uBiVKboGE5TIj3uGmXZmO06jqtrbqDkt+DGoaCfApxGO82rV/aljf4+Ncok= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by DB8PR04MB7067.eurprd04.prod.outlook.com (2603:10a6:10:12a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Tue, 18 Jul 2023 09:50:51 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a%5]) with mapi id 15.20.6588.031; Tue, 18 Jul 2023 09:50:50 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/5] media: amphion: fix REVERSE_INULL issues reported by coverity Date: Tue, 18 Jul 2023 17:50:10 +0800 Message-Id: <4dc65b83d866d91062e52d7caca88663f4934a56.1689673395.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:4:197::8) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB8PR04MB7067:EE_ X-MS-Office365-Filtering-Correlation-Id: 66445956-5991-4de0-aa76-08db87747840 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4ej7Q5wPSnEvqtHdbnnEf7/ifZbkOSR+6nNHgzf3jR03rNQXQq3mLAWouuzQCE8Yb3NdsdvWwKSAtyRXSUkUvqDab0t5JUdbgk8ILsIfhCUU9l341Zr5aX3Tuoa5CHL49QUa6BU8MA64r00pFvO3pEHwi7EN1ykvO/Q6TSqEXEt3kBNKl9t9YDwbw/bqRhwgDonW300ErtZQ+/EPSzagPNgNlZ8HpmiDeQi1U/pgbMYbJOTXUyTIDthfjjwa/6YyPyYGw5vE0siHSO/0U7RGg9yrUHaBgy+mQct60qXgB9n59dEpZp4A7L1uKXogEsFGDtrQZJ4MNK7QYno7pOancRoPsnTHmzdmgGqN/xVOJbwrxSUccSembYik+WBiEAvG1awOb3kAnVpxv04dbV/UOtdnLq/TcMNgQDHqNfhJUgTEz9T6iwsWf7RJ2TSP5bbVGKMixP8QWTkkafDvsqB/WHOBg6DZJ9lV0wxJerBXub1okgCcNEHciDBg0PuT4p0Mw4cySVEZ9n7ZMVqtHPTraltd207Wqv7mEhrzTlisufCAU8HwZShTvPkioSCStLedBZfzl9eNB8VbHkTVNO/xnUzY8G8vP1KCcV8jwbXEUGZD507+yg+eSyu7jx2Pe5A1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(376002)(39860400002)(136003)(346002)(396003)(451199021)(7416002)(86362001)(2906002)(36756003)(44832011)(2616005)(6512007)(83380400001)(186003)(6506007)(26005)(38350700002)(38100700002)(52116002)(6486002)(6666004)(4326008)(66946007)(66476007)(66556008)(316002)(5660300002)(478600001)(8676002)(41300700001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: V2qhLGfTL0aQeWHhOv9WMX72hDAw4RgpaW8ErfnLzdAd/zXXCchQXNNy1/tkWhEwFvUdHauGkBNNVBoNQ8XGhjcYTrEfrLmBq1zOx1Gwsnmdpe7P34ILSgW7zJjmTDT4HbehpSyMSDuh3Z2J46BAyJgeNaQbEYfyoxIF6UccvEPq5LdW5BThqcvwfdVjYB82Ia2eXM03xZuRFSsiz6RSiqAtzGDl4unaSRdLxINs2nQAI+XIh4+j6SnOVZPlZBeH3ShF51dNETr/l11HoMyouGlnvRsF7Gb7fLjZQzgfFWvWzKyP0Gm6NZzOozl8lZFJPdffFVGWP3f/AQ1XFDShI5C4hBBs3njjpYMfBAkL6E8H6KPUxqnY2POj5OEFd2bD5ruxesT5XI4pYIr5QZxkeY0FoPTVrFIaJ9yj5i7BEsLgKQK3EOF3OxcEbs84tW8ussO8BYoNsCKXOrL3+xtZLLi408gqVSpJjAxxbAfVxBDn4snjWdPogizIB/YLnCvObfnQLuWbS0hp85vf6Ar3Y3PNrZkdBHNzlqcOAJV+FCgy5EmE9dmL407h4qU7lqGSZGCSb5BPyswyaQZ021r6/+nt9v915wY/feg3QCUfV5FD21zSUqnerIotD9ixXjihpFrdmCIGYvHxEAxeDhdCyIsi1UQcPOXjnxvwNPLCiTixv4cAxmzyGsjLzHe6Dc6tmvnUIj5eD2C3jstBeT5N6zqddOS1MtNWyWa6pUusXX8qzQVxRrcguOyJnyrBv2BzSumGQMEBS12teWz9LzuI0RUi2w4f299GNVNxJanqO98TWYzykC5JijlmURi/lxh3wkVXGMZkslpnueK14rjjpz1EjZ6QvAE5CQfTEFkKFR7vXMjZEHzMC2GNNadTplKPgWsYuZSyBmYbHuub0dO1dyTmFwMKiSSuIGvHJaYwuhbTqt04aZUaXHvDpBdK4/Vs+8RtS4IrNJ3F6w2quCIEJm13guzgYjGhhWAGVKus6yaJIKMqOlwJex6j7XMo4n+evhoUYVbjVzw9/HTGdTL7jQOfXufturKwwI0tTL8RrDHaz1yzkRKTY517Yz9JnuP/txhC25AQnW4m3VCE6PGqDqD8iVJrHrnWk1KSYCuj+8rKeNfd7YPVMVH8hQZfi7o5so8OCc+8OcdO3KFmBEe/D5SsLCYhESp43RS3iM87oF3udb9kKp+2SQ/KrZv6hYPabZJmadWtF7nYMIcg6IUCoUbqgoX1IYSULkHaPk3hMuWpQ6sxVnyAc3tfrXR6PCwktH+r0nOhbXicqeO0MQOBnSXNULuKWFuZXoerQr8gFUSa3UJBiFJxysvJWZvC2FtUp+F6EVv3oBeDcssI9T898CjzB/UDz9V7W1NLXw0o4hR2xgGSVw5HwGpGE7T3LhvERrQsYvvP/F7oTfnQKSJ2rHTjwGgLwTHKb3+skWd0UDGG5gPkuXsLpd1qczQqOTTA5qFHPFrXI9Jx+HoDC8f9GJtXb7ryg4UDUYLYwHT9SE15/VzGedSf6lC3I8V/H6/E0XPNG+a7DNFu0dCfZaM/ko55Dvb2mlkcm69IJpOFc4MgLGZ5gD2Aqlm041s1iiAO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66445956-5991-4de0-aa76-08db87747840 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 09:50:50.8331 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: d5VpRAqJDFxzrMGH0YKsDklJb/5STbgJ4p08R3OjXE9lWYA9rc5F74e7pvwKGMDmbPLnpFYk2GYQiJcbHqB6Dw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7067 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771751773201378301 X-GMAIL-MSGID: 1771751773201378301 null-checking of a pointor is suggested before dereferencing it Fixes: 9f599f351e86 ("media: amphion: add vpu core driver") Reviewed-by: Nicolas Dufresne Signed-off-by: Ming Qian --- drivers/media/platform/amphion/venc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c index 58480e2755ec..4eb57d793a9c 100644 --- a/drivers/media/platform/amphion/venc.c +++ b/drivers/media/platform/amphion/venc.c @@ -268,7 +268,7 @@ static int venc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *parm { struct vpu_inst *inst = to_inst(file); struct venc_t *venc = inst->priv; - struct v4l2_fract *timeperframe = &parm->parm.capture.timeperframe; + struct v4l2_fract *timeperframe; if (!parm) return -EINVAL; @@ -279,6 +279,7 @@ static int venc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *parm if (!vpu_helper_check_type(inst, parm->type)) return -EINVAL; + timeperframe = &parm->parm.capture.timeperframe; parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; parm->parm.capture.readbuffers = 0; timeperframe->numerator = venc->params.frame_rate.numerator; @@ -291,7 +292,7 @@ static int venc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *parm { struct vpu_inst *inst = to_inst(file); struct venc_t *venc = inst->priv; - struct v4l2_fract *timeperframe = &parm->parm.capture.timeperframe; + struct v4l2_fract *timeperframe; unsigned long n, d; if (!parm) @@ -303,6 +304,7 @@ static int venc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *parm if (!vpu_helper_check_type(inst, parm->type)) return -EINVAL; + timeperframe = &parm->parm.capture.timeperframe; if (!timeperframe->numerator) timeperframe->numerator = venc->params.frame_rate.numerator; if (!timeperframe->denominator) From patchwork Tue Jul 18 09:50:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 121924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1624697vqt; Tue, 18 Jul 2023 02:56:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFF9Td+FtAYVbiwRC+W16tDRN03fII8N4EVzVaO/Qv3fZBfXYr3/KFpdYDhDY/+yswNjTQM X-Received: by 2002:a05:6358:704:b0:134:e631:fd2b with SMTP id e4-20020a056358070400b00134e631fd2bmr2458825rwj.0.1689674196624; Tue, 18 Jul 2023 02:56:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689674196; cv=pass; d=google.com; s=arc-20160816; b=RGsUnpKGAU/XD78LdovOOQ0FDdCz3Hapa12xWwBxU85j7cYJjJs3r8ow+QOb6NiEqw 3bvdHrtS2OkDapuZvwgSBD3vR95yRiVhsms6VYPzQnd7304izN10ZVc4nF1iL3uPLSD8 Jam0Pn3Te+zVSZ/7oB6shD4wFzbUO8Gm5JEb7APtMhcTOECTq+P9SJT3BafYodLj6c8S 9g7ppyX9SDJQNpmRqUD0LgdD8fPw3A0KnuwNlcyPGtqEbtpq93O8yWl0RLZ4xPrgNLM+ N97boEYSM3n/j3nbznU4896hAu2YWjiDdMvxi9g5toz1QEpJxRWt3HMlayfxYwMzRP5p woYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vSDokErEW24Y+K/+FEmUkfXUYoJN/EsPto2y3M0PEqQ=; fh=GAC17AFk4Pml4KicrhQSrAcjdb11ws2HmGr+fDle9es=; b=o/Q/zq194IwAYIU+qKgttGC+cQQFDISwDuOMzz4Lzr0srdVI44tsI6wMvHA/9rsdRh j/4dhtsRYGPkH+AdDKExTTIC/0+IpoWAsDY3gVECtVIvXVpJRRm0xdL6PSYWHQofU4Uc Va/neLr1i4PpsoxU6YriEp5zP7gocL3roKJinoU9uCcDPzAt7FzuNC6qAkYmWWd81IQo 6rlu9BFsmmKUofKMCj0wdo2j/3zbF23Ts6m8U8chOmozXEjIPi8lwRGhsXp/nUavkEDZ +HYH6HPq3bbLqfwTitpzoXg1PFEpJS5WNftp4Ebk3rktrWoIpZTnYRHwM1Qen98M6ybq iwLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=oleAhlwb; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t70-20020a638149000000b0055b3d494058si1405006pgd.23.2023.07.18.02.56.22; Tue, 18 Jul 2023 02:56:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=oleAhlwb; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232304AbjGRJva (ORCPT + 99 others); Tue, 18 Jul 2023 05:51:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbjGRJu7 (ORCPT ); Tue, 18 Jul 2023 05:50:59 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2071.outbound.protection.outlook.com [40.107.7.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6804FB; Tue, 18 Jul 2023 02:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jf3roXMZpezT5PLPEiFdYC6UZg3lp1tZAlB1+JnwZRkyt5uguQUSgeob1J/QnOZWRPI957ZbXt4gVPGiJnMIRoPSNwZOkqHbKkqKbYwCSojegteEHvMO1JEKmnLTM3k+Wq3LGEh0MAEcyhjoxQb1PyOFHLtfLBJKoca8ELJ3r61CeKdrhKnTF/P5pjuKxmxSH8Sm+LJz2IVy1lYMrewcB2NJuBtsXmZVyLoqRmmhHsBYALSJeGAWnD602Gr3fnYk04o57tXeY01Q5X2ca3R7J8Vki0KVR2WSPpwoNYdpoaCXCLULsOX+YXe5MEFO9spmqMdK5Nxr1w9IAvQCiqNI0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vSDokErEW24Y+K/+FEmUkfXUYoJN/EsPto2y3M0PEqQ=; b=VEqDS8Xo2R0V/c5v8IZ1hHpNbYaUhv+4ft0Ir4gb8dnDA2iB6POvXk/qS0BYVdweOHo6LTbQ6EBvaU98gzSD0x8toNI8S3I2G2pVacbnVDWiHB+yKBdRj/41HdGpcc+i8PErUwBHOUZ3196G3m7T2jIE2CS9V2OeI2fbMOimIjaAYcDrsbSjWd8I6kqBPTpLt6ZIN/fCorvcdcsB4XNew+DmfnIQsiVz1ZPXulxghUO3m5pxTDSg7fVwy232noa0KTNPbTelTmjS2gzKxa0LISk9FNA1JIx2nyKz96Z2ZF3Rkd4z2Zuwgj1hK/+da/HXgRH7wxQASKSO582KUiNzEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vSDokErEW24Y+K/+FEmUkfXUYoJN/EsPto2y3M0PEqQ=; b=oleAhlwbMW4QSBhWTRALiQbxqwjVWcKS1i3N2CxyPSrum5YIT34ramEvEvYztMw8P6TH96qwR18C4nqBtbyJ7vUPbco6xHMqq44qoctUG6f1UT+JbvMx3Spoxm2ywt3BOMAEhvK6JpQJv+Pz02CFNB+BCSRRwvORDoY3oFFu9M0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by DB8PR04MB7067.eurprd04.prod.outlook.com (2603:10a6:10:12a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Tue, 18 Jul 2023 09:50:55 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a%5]) with mapi id 15.20.6588.031; Tue, 18 Jul 2023 09:50:55 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/5] media: amphion: fix UNINIT issues reported by coverity Date: Tue, 18 Jul 2023 17:50:11 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:4:197::8) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB8PR04MB7067:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f7116e4-3e69-4877-46cb-08db87747ad0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TgJKkiK6kC+lZ/sIRIAnrE+3V0S5l4kYoDYqc7onqdwlyse9aE5RaTVeUT/rnqtEUhcxxW72tYdKPXq8+8lG0unAmPJoErAdGtygVDAr/tt8dbBe6hba/7fmPpVRK2z9qjwIueHJ6iaNPENqf6nfcWYKLR7rJVX5E8IkccN1a7JDZj9rkKSrbD/0eOpGnynrGtfeKV2B1IhbaxpliAOumanBx/uuHTujYXl8+x8X5bisrvcNeoD361nNF5mA5XXbhHsAtwKaiHdyT8zcTH7zFccrv8gRi/cjCKKiQxgh/bcq8l78RvjzN5N7hd2bgNOqZcdl+H46bWsnCLA8AgKHbTBAXtU7Xtl9OMv4Ipy81luO6LNmvRhB92N7RfaJpvv+vqPxLZ+9mYo+OJofebCLTAMX8pK8lpOOYq8wWs8iBcp/+Q7UUm86RkPEnon0vMnUxXh/msoPBdBzENGC76yDcQ9/A6uveIjWCI8JBPw3dzXiTyB5tS2Z7KTrm9k/jPzccZb3NoyMhvFNaokymtH7OCJHgRCa3fWlcMLuNTYhw7XpnGworoxer6KS+tC3HPNiZgS8w0gng5Msb5al5Jvd7tLQ8wIf5muNtHYqQ011+LpUKw+p/oOfjVdhgxRigFWY X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(376002)(39860400002)(136003)(346002)(396003)(451199021)(7416002)(86362001)(2906002)(36756003)(44832011)(2616005)(6512007)(83380400001)(186003)(6506007)(26005)(38350700002)(38100700002)(52116002)(6486002)(6666004)(4326008)(66946007)(66476007)(66556008)(316002)(5660300002)(478600001)(8676002)(41300700001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sqptiiUJcYkbqD/eRGYAJ49z+7EV14ts55lWT+YKirH/ee+DV22/eyYrrvHuim80tMqthgFu+15euzifEsVGLrqVcuQiDTTlrn6sz0p95Q3Vg5RCzK0MySXEX5do4H0oD44xbFBckgIvU41Y0KLHLlQ1L0KtDbG/axtJKJUKmY0V2oA8DcX87IbxW01SadXCcQPfIyrJoF3mipyXkmhlzeXXC/yfbFqbslDMTenZES2iVwX21wpIHXFD70O0NGnnTy5dLhZ/MSjOia6xq0gUPaVpiPTFI/PD6svdI941aREeOULImQwEKQz/8YDiZpXfEdVTKV6sA7LSRfpZFPqTZzvN2/+NZJeuwqBgvs/xYG6cls8otRqcedhc7nEChezzCsKFjgynFuuf359dd5rZ0FGlEvHxcw1/UXUB67zc3/sGTGQfOGvJeAcqFqbe/dZHrTRXz15qhhQAKRg56/2qjXyerj1GsyO2PA4ESIbn47DxQxr0eZuW1JxZS3pPz/654xxmLFOCDBahI9KzozSfU0M86C3vj6z5i7/LPTiL22WKrieNFdeeNLwR9tmoqhCUCBfnZ6aN7a6/SPX7xiF5lPfj+MKe8dtllaa53svtETxVtfDyoBExWH4gNlpcJNevgAa64UfjCqxXYc5l8bPbZH8BuYsyyefq0l2Us+0NawMb5bdOQJpixBnnlmhdF262X/BiZSGakNZvNYn8/zqAozHvI0POF36xTxakaw+5L+CRxwYxZnY1dz8UsGEMYt04g48nOQ9IlMsLcf91VGzd0J02KRJDE6jZwZ8iCFf8+MB1mm8N8MAGtxKWzbypdMNTEQC165jU7UW6L8FObkltsq1YCb/xDmr9Ji12Jq40VIGzVe5WH6KNeRGvT0ypJyEfOGnceLu/fO3ce0bnAFvlClA76AmmAdNzhh9g1wPX38xm7BKz7Z2jjOwAmBZYrHKg3TsYuJj1NQbGSsrlOhKEVpFMHRncT3W+eMNUw2y8elW5KYhQKyFt7wEjUXIiy0qHhGV/O3dcDS+zCLfZkUwWwsw1QU9fSRZdwkhtx7Vngt00VOBPyURS4KqxHO1wUIOUWng2c10ee7lgYTvAREIu20F48AJsaKxF7UmO6bTnaOZpZ7RFYN8VdRYb2AHCGZBxUeV5sRYVBFm2cuge8jzpW/Ff2yvcs9Ya+8gV1qIkcv7qbdaqyGjpK7Q2p72X/fx7F/wmU0kShoqwiF9RFHMwWHy6H4QgMegm8giL7VFY/5tXPaC65FF52JvSe/o9RDbhzoou6uRNZj0Y+0wjRppmT/peOiYZTUNkhHqFr5aynbt3iC/Y15e2daIRpm1Uf3XtkSjESGmNPNxeRlLfcUA4NdooWeWmDeB8IrcjKKtB0RQimSCDkfWlRy6d1L/hGXrrKcgOH4jQp5S8qx1A91FCFPrEnbuecaQI9cdts/20gNQVBJXB4cFYdsEgPg9i95AAq9zlySz6VKKu/YFLNV9MpBmQUe5ZhYtxBZvidZ8bkUJXgtDzqthl0pj8Vnw8NeRzdrfwpWp27qbebO1ybJ2/86ebIHzeHXcDQxzs8KBfksOJiktbpwRg/qloVKzaR4Y4 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f7116e4-3e69-4877-46cb-08db87747ad0 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 09:50:55.1908 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UtG3ux/ERUrBDiez0CHuT8i1BSQI4L5TGCi9MLnuSdYle+SYoc6v5YOGCHNqhX3ci09tZviptaOtO8h1V0yJcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7067 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771751810290580834 X-GMAIL-MSGID: 1771751810290580834 using uninitialized value may introduce risk Fixes: 9f599f351e86 ("media: amphion: add vpu core driver") Reviewed-by: Nicolas Dufresne Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vpu_msgs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/amphion/vpu_msgs.c b/drivers/media/platform/amphion/vpu_msgs.c index f9eb488d1b5e..d0ead051f7d1 100644 --- a/drivers/media/platform/amphion/vpu_msgs.c +++ b/drivers/media/platform/amphion/vpu_msgs.c @@ -32,7 +32,7 @@ static void vpu_session_handle_start_done(struct vpu_inst *inst, struct vpu_rpc_ static void vpu_session_handle_mem_request(struct vpu_inst *inst, struct vpu_rpc_event *pkt) { - struct vpu_pkt_mem_req_data req_data; + struct vpu_pkt_mem_req_data req_data = { 0 }; vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&req_data); vpu_trace(inst->dev, "[%d] %d:%d %d:%d %d:%d\n", @@ -80,7 +80,7 @@ static void vpu_session_handle_resolution_change(struct vpu_inst *inst, struct v static void vpu_session_handle_enc_frame_done(struct vpu_inst *inst, struct vpu_rpc_event *pkt) { - struct vpu_enc_pic_info info; + struct vpu_enc_pic_info info = { 0 }; vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&info); dev_dbg(inst->dev, "[%d] frame id = %d, wptr = 0x%x, size = %d\n", @@ -90,7 +90,7 @@ static void vpu_session_handle_enc_frame_done(struct vpu_inst *inst, struct vpu_ static void vpu_session_handle_frame_request(struct vpu_inst *inst, struct vpu_rpc_event *pkt) { - struct vpu_fs_info fs; + struct vpu_fs_info fs = { 0 }; vpu_iface_unpack_msg_data(inst->core, pkt, &fs); call_void_vop(inst, event_notify, VPU_MSG_ID_FRAME_REQ, &fs); @@ -107,7 +107,7 @@ static void vpu_session_handle_frame_release(struct vpu_inst *inst, struct vpu_r info.type = inst->out_format.type; call_void_vop(inst, buf_done, &info); } else if (inst->core->type == VPU_CORE_TYPE_DEC) { - struct vpu_fs_info fs; + struct vpu_fs_info fs = { 0 }; vpu_iface_unpack_msg_data(inst->core, pkt, &fs); call_void_vop(inst, event_notify, VPU_MSG_ID_FRAME_RELEASE, &fs); @@ -122,7 +122,7 @@ static void vpu_session_handle_input_done(struct vpu_inst *inst, struct vpu_rpc_ static void vpu_session_handle_pic_decoded(struct vpu_inst *inst, struct vpu_rpc_event *pkt) { - struct vpu_dec_pic_info info; + struct vpu_dec_pic_info info = { 0 }; vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&info); call_void_vop(inst, get_one_frame, &info); @@ -130,7 +130,7 @@ static void vpu_session_handle_pic_decoded(struct vpu_inst *inst, struct vpu_rpc static void vpu_session_handle_pic_done(struct vpu_inst *inst, struct vpu_rpc_event *pkt) { - struct vpu_dec_pic_info info; + struct vpu_dec_pic_info info = { 0 }; struct vpu_frame_info frame; memset(&frame, 0, sizeof(frame)); From patchwork Tue Jul 18 09:50:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 121931 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1633200vqt; Tue, 18 Jul 2023 03:12:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWEojIetSr+7QMG9UozvdyZXiFgPymuhETg1W+KBtzqsrw4+MBOHmnwpfi0il/OqDmMqut X-Received: by 2002:a05:6830:1059:b0:6b9:d06a:1284 with SMTP id b25-20020a056830105900b006b9d06a1284mr6042355otp.21.1689675136876; Tue, 18 Jul 2023 03:12:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689675136; cv=pass; d=google.com; s=arc-20160816; b=ECm8t76GhoUd/O5EjC1PTn6v84dW4VlVyBlAMXzdQWooC9iHLKIqGTcwZ/j28PnK8J yp0aSXkIxBUPnN0VAD2CUoP8IhCkycYCaswCEpFrMqWw3HHs3dXH6hb5ynpFB4EAewoO CfL1LE9yhB9jPcccNMBX06uyYSlpPhH5LnPMrSjWwdfHnAj3pzk6HrfZ2Mts5CIWlIWH 6+IMq8orVM7HyNlCLR9fWdlpzp1bYepxKi/47Y+gmOn/SD32Ykz8M2fnNDkhI34giFVA NwAIjvyMG81aHdF0Bs/LIuf3stcxa9SHvKupmcO3Ii1lVlGE1kyK5Qf7McxuenWq9zte UK0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WikWkd9d9vvysIloiy7srXDggPWB1NrwjogQ2EBZejU=; fh=GAC17AFk4Pml4KicrhQSrAcjdb11ws2HmGr+fDle9es=; b=oiJ6Y7RXtJrnf92Fp894Cnt4NQgWVJr+6ONEVDgNTwghtdN3sPCIslI7o8qHiZhSg1 9JwXDJ/knNtvcYz44WtPTY66LdftPq6sqSJrvTagIIez4By6tSdh5Ulc8QD2YANXlUQs Txt2gsZD3JVh5DuPhfeOqiVSmcuWeQTxMJTGJEIgAQJM2ZEd3xlh6q067EkCe8a2bxHO y5kmLBoiFG4dl00BFmlZSAqGjOep8AHdITvVHh3oDcqPbXqweA6D8FIRs+gWaG3GJWcQ 8tqZMdqREHv1clKxdCNlqNucH1v05FHn4I5EI55b0KUCo4SSUHssS2oUwO0xD/i45lYW OMNA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=EObprGIq; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k186-20020a6384c3000000b0055337cf6342si1370237pgd.332.2023.07.18.03.12.01; Tue, 18 Jul 2023 03:12:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=EObprGIq; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232364AbjGRJvg (ORCPT + 99 others); Tue, 18 Jul 2023 05:51:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232101AbjGRJvD (ORCPT ); Tue, 18 Jul 2023 05:51:03 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2050.outbound.protection.outlook.com [40.107.14.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42DB8F1; Tue, 18 Jul 2023 02:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GS8pJnPr08Ejm8C0JNYpdY4xbDhuOQNFFXY/nikLpwxKdEOYz69oPVb2RW4QifrcndEzK6Gk4AoT9BZMFIG85Yy7C6GG1Oo80BhUxHpodGrwpJNZGFECMviEftp3TGLRI5rHurihokrqSwvWvGFqdLZHMq2qgAhg2morxWlEyR3HpAT2gmm20/S8SbeMs2mqfxoUIIrcd65+BrubCcIoorL/MLiTg1nL+RxEKcWwPv8GNPiE5guY15v/aqzGgG4QHZmQ24jvbblk9NNOeX/0ny7YflW+qoIRkeFXH4NSZkOEYQAyNSCFlX3ytxZsyUJSHXVXn57NCeIW4yIorCxJ1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WikWkd9d9vvysIloiy7srXDggPWB1NrwjogQ2EBZejU=; b=BLJgKGzi2Ly6GZeXTVbS8+BabvhuenenPl2Ay93XmtXUgSNak5EGAp20y7sCqWfybKTSO2rus1sgKRptGmuldyiGzyb6Doe6gI22QX02Ieca9aFtjWyFBXw4A3wy8q/+mNQ+ocH2yAJqAS8K5c62Fwbn06CmTjbrVS8M/ypStzHKp9rZrY5TpnhXRswy2gti1Axv7gEraGnfWgJeizelmqgyPciqaZoWjoYomKPvQn5sgOR1bUY5T14nY/WXsnw3qO38CJtsb17aA8gtKaXCq951dbclZD+SMA++i924gYUHj/L+17mIoF5JgU4BFD4PRIVpGQR8aJXstEYjzS6AxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WikWkd9d9vvysIloiy7srXDggPWB1NrwjogQ2EBZejU=; b=EObprGIqqmyGEtEIiwI1yEzypu7zVvEwCadTBqNgHU6PCO/i7Tgf5LqidVQ0+ZUXagHUM60zumfHm1yooYTIsf7BovcflqP+yLEC9GgQA3uYyedKV05CbpL74hm+d+cdlDVsT6iRIVRz/bL4rFYiUR9id57nOGHs2c1W+jDvuHA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by DB8PR04MB7067.eurprd04.prod.outlook.com (2603:10a6:10:12a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Tue, 18 Jul 2023 09:50:59 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a%5]) with mapi id 15.20.6588.031; Tue, 18 Jul 2023 09:50:59 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/5] media: amphion: fix UNUSED_VALUE issue reported by coverity Date: Tue, 18 Jul 2023 17:50:12 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:4:197::8) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB8PR04MB7067:EE_ X-MS-Office365-Filtering-Correlation-Id: b63aea81-dc68-479d-0a18-08db87747d67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qzJFIYEg7X4tIczFJOtmTJO8cyi7Lar8cXx5XryiRRYl/MntVa66yw9dBSQ6D8KRfBHoc97um1UD7ZgfCi/xYtWiF/qw57pRdDmAcNeCkBhTvNgliFbkjP7C/ut5rz3FAAo6eNagR5RhrjHCCMSjOtKmwgUOXtju5Mg/aA85JPMBFrFZg0nKSkbWGL2uAKqHiO02rH8wfd1JucIDUUjSNFWkCMf0hDo/fVPYtB9mpM1JU2oqeGOTx6yY3inw9nhh1Nl06iiyWODXc2Kn9jnV8I4RfVngfKMWcL398sFpvsh7lqucVKLv42jxP3uezueyBzm978gVwTLgYSzJtpusq+FK9T4VB6gxu5NkRMvzx6yZpZopCoofMITihzUS13N4D0ffDrro+I53ePIS8/tG8FteFyksxoAotEKAWd6gf8hpNqvJ2VxHpuVoHGseLDbkLLycrzre2Gz5dZDixGBoFWKoF6zurVFTdNuC6TFZu6D7f5uhpy4j9K1OQTtl4J5+2tJRQEgEBchdxJwDc9k4WfXlWXl4euSr7/0J3sXvzmhdD0I5Ai8LSPd/Nzd/BsggO50+FMN65hK8r5uGqNtDCJz/tKgTEn2qGzfr+7EMEGVhE41/aajJLmDAxXdlFsWG X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(376002)(39860400002)(136003)(346002)(396003)(451199021)(7416002)(86362001)(2906002)(4744005)(36756003)(44832011)(2616005)(6512007)(83380400001)(186003)(6506007)(26005)(38350700002)(38100700002)(52116002)(6486002)(6666004)(4326008)(66946007)(66476007)(66556008)(316002)(5660300002)(478600001)(8676002)(41300700001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q7qA6zTkBBljR96zdPLUiqfqTE5PPU8eMmwJQ4MlSMxVwKxxCzWv9/LCvD+U6QysZpH3wQrPaJJBikRSOV/wQ/ZrsMR2OyojQUMrMCKEXgioBasRWVgH/tSAvUNEKXiJO+Y3IjGzS8VHekSaAeU0sPS929hOjZCd8cLA1QbKUQg3E6Znrn31DtBuqetc5EDJdcK2/kS52dfXPndoPWQXlo9ZXhDHwTS63LG/ClwOvRDA6649jGnYwVj3O2hHGFZwlCTvp9RZcGHhrHgzhusI2TY9IM82/VoKXDSlNkXrvEBByCOYew+6kFgGuQOG7O5vmnfeGjCon/Ve5/YqYALQEPzXEcFkzELWcaN0zw8CD0s2UP0UOoEksKZE4nmErNYcHKptiaNsL2pYoGbB5TxhGg+n1ncPCuY68wips+8zXMS6xUzeRKZuRDWv36oF/TEXDGjJzrwFrB/6uHtCkjZsEzAFRLhj3bEBGN59iN62SrKMM/162p3V7AEgmGF11McEgtbgia2YcmrAdwAQFvo+oe8NYMRez2KQmZ7/BfKYYROvaRmSsjM4AOy1o1Zb98mRIuZp92qFYOLnLu3m8XdATLga+3bhC6BPp6NiVAta2DS3jY5BOx1l6NahACDRlLcGRPQjMy5Gi6rJdJCXSjlKCzoJ9z/4JEta3a6jmic9sTKBo+nJNB1kXBDQ1vcCeMwHBVDgUAQD/hlagBInQOx7L0nprVmswehvYbIA9XXWGPjrKZtdObDi7glWp25JAj8K1R1JdIbIDDGP1wUP5yItFmHZeAcjX0cACma+OQtdnTu4mMhDe37ge6pNn/UuRoWryQZllhBVfiP+gRR1Vu/ES6GL30qPv3Y8LqLmqXhPJ/Rv5rFSy+/IlL+C7Qz9K34LaziScZjJlAJ9l7LhiTPsBnNARsPDCm9uop3Xdhlc0bCfh7ZFuDWWKFrv57KB7digRWnONYlIYAOLSMkV2RNfApxQrr6B5MfCNGJaH8Qk3uKJiJyx9SLSZjmwbnezkSaB4/YG+zdf1n1dMjdAQjpEdUXcpEjyevcT7XiT8rpXja4DjDRNXfk3ZexXhTdY1APzrzANy8vDkn/tjhkF5hdMC/NJAs0/su3XMVad+i8j6mVnaETvFuNHhAdD9FxZxS0itC5b1nx8fThuGRMzfZhDUK/gwLTnjn99jR9lvY7pbf2BqqyPlTBpcQwPG0mqJEIGusmcBMbAf1iSIZz4PspzICzU0KZMBK/kqn9KD1khqpnEDQrFz0PYKr05dHHo44qSzv/bstHk3Qb/xP/mrqttOddbJdEGROsGW83b0PxWnH0F022s+UlcT8qpS/H1HojllSHnGkX+dzyzM/Ejx2ECGG8Je2PUSxiPSXFOTaJ3Uog0RSAlgy3yuvDVJgqLcLOOtuBPWUzfUNcMTBdh73A8rmKxyKednHKmtRtOcXi/1szJpFzmNFhz70dIvHu97Tk8glm6r1vo5+Ln/0pdYHvjBiS5tcOMGRsdCO2wsuze6jfeJ2Hb750OZr5ezYV6uqoJRUScAgC6IvKFdD6Q0BguCOtYVmqUCyfu+ix444RZoj6vVSVmBxSBQZrZw7HNUJRu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b63aea81-dc68-479d-0a18-08db87747d67 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 09:50:59.6287 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2REs+6ITlCsC9rn4X6gmnbpAE+PPZfFZ/lvHh1KTVqavu6Pga6C7Hlr1PpHYfOWScE05jTTzdKQqGtLAdaGFqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7067 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771752796249146754 X-GMAIL-MSGID: 1771752796249146754 assign value '-EINVAL' to ret, but the stored value is overwritten before it can be used Fixes: 9f599f351e86 ("media: amphion: add vpu core driver") Reviewed-by: Nicolas Dufresne Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vpu_cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/vpu_cmds.c b/drivers/media/platform/amphion/vpu_cmds.c index 7e137f276c3b..235b71398d40 100644 --- a/drivers/media/platform/amphion/vpu_cmds.c +++ b/drivers/media/platform/amphion/vpu_cmds.c @@ -315,7 +315,7 @@ static int vpu_session_send_cmd(struct vpu_inst *inst, u32 id, void *data) { unsigned long key; int sync = false; - int ret = -EINVAL; + int ret; if (inst->id < 0) return -EINVAL; From patchwork Tue Jul 18 09:50:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 121928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1632809vqt; Tue, 18 Jul 2023 03:11:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlFvQNSpegBOmDmUs9LC03+xbJcdeQozY9YQoQB42GHrtZ9S0My+Q6d64DfzjktVepVP3tlq X-Received: by 2002:a17:906:1014:b0:994:4f10:fb36 with SMTP id 20-20020a170906101400b009944f10fb36mr10242870ejm.41.1689675094692; Tue, 18 Jul 2023 03:11:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689675094; cv=pass; d=google.com; s=arc-20160816; b=h1pJqPhFpbJmSft62hk3alI4q47f5oEln7qh4agogqnZeUn9HGjK+3B9tA/yAIrt0w XDRkXhY4nCliyV8b6oO65kkwDRvUQGDZwXlj6frK6GF8u/1Ifar4Sz+N2Q/Ck1c5hSs+ mJQ7K4TekHJKHVw1egRfHcUIe7DP7WLoflhmJeSF9Jhbsaxci7sMKrMDNjGF++IgyHIj UWD0F+ooj7xJzUZUxmbGCa8wHXscmho9oHHpD+zZVGQGgpew4ZDwdemSp0EBwHOQVq2S TKf4slkqifLut+uRnNsKku9H4N+ILb5bp9WCedHBj3oueDOJZbWvCH48g3pVnWfT4PLK K3lA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=20G3mcqhQwbuDatCJ1tAgjhv5x52jZDh+tZLmUBxvg8=; fh=GAC17AFk4Pml4KicrhQSrAcjdb11ws2HmGr+fDle9es=; b=rCtRbyZIta6wADfMsRdl6IltGwO0OqzcU/cUKPGso+0qfloAuPcmLpIKgEYMgRoa1E ddnGl0tHt8npfi/bZDrO6tPQhU87GCMC/WKlfod89o3nokU0IANVqwVk80kXIsILL0Jc sXUNLHZrEGoJimJ/rUQPDniCN72i31LwN9FRX9/nWcXKzMrktSim8Du35ciP0//nC4Y+ vz//o/KjI5Dga+efmrwNMfJBQuDQAw+lWnBUZB8TNnWGxpvBZNb+wNNJDdCtU1PE/gYs Drd64kaQUQbY1wehIGJ//tJ5Ry8E8zxXVzYVbBX7ZmvEqbHJQ1mZSXaiXy6g/5Xjp/3X hSIg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="SLYK/RG0"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170906604200b0099318359ea8si900300ejj.452.2023.07.18.03.11.04; Tue, 18 Jul 2023 03:11:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="SLYK/RG0"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232382AbjGRJvm (ORCPT + 99 others); Tue, 18 Jul 2023 05:51:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232321AbjGRJvL (ORCPT ); Tue, 18 Jul 2023 05:51:11 -0400 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2056.outbound.protection.outlook.com [40.107.247.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EACB5128; Tue, 18 Jul 2023 02:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B7rzXGHOoSg8J55eYkXRQyKKmYMHxKz+1CI/xzd0MFkQKy/VnEg9opRlVTHGxmoOuNgWM/YrzjtO7KzrcoUZU6D6L38DFyqB8qlgt26l2E7Vipvtlc4u+8vtSIyoqR26aSB98nfsUeVFldg0riBY3OIlewiLxqrakCUYow6xlmlVDWIoYDB+wZukIDUJzGCAjf8GHoZUGshVCth7dY07nRG43ey0UXNCpCn2rUsnhRtEis3yaeMqfg7R6BWXxS/XydWLunSy9fEuKHWcUar4/TnE+Xfe95NUvoxMzIE95n/WmVPeYbW7KxDbrGwx58VueGiN3R6F4LXGTpLM7SxjvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=20G3mcqhQwbuDatCJ1tAgjhv5x52jZDh+tZLmUBxvg8=; b=D8N7TDRc6lpw+Iueycf5ymzgMlakhbWCFnGjdu85Xa/qhE/ZN2RB3xntLypMohkQes+zyBZvhDgUeXtmXd1xyS/ApRlpRlMsYflMcPeXDjKjdUkbP4a1Kzx1/1dRmQtmhf7G3WAzOqHSkMRxH+lLZBr05ARb2AxcX6eBMCityY7EPb6ZW1/nk1IyzfzxRa0UUrTw9NhQ9+hW/A2tyQvA/8Ofafmf6Mw8vUPVb6abUTv3Qg3OAPCiezrYRA2SXTtkbd5eXpLfDZAZRk2ZfPSGiSMmw3xt6yL//TMCSh4AsxtzFswTVNwRAv8yzVOp6kDasLi4MzzYzNnqK6bKbEGwUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=20G3mcqhQwbuDatCJ1tAgjhv5x52jZDh+tZLmUBxvg8=; b=SLYK/RG0N0+FwhR06ur0H9vcdhVCTj2jjQYwAS2XvngLJAn8J4trXqDmgUfcId9zsU0KUGQyl/gp6mQBAe93g2HbDxY70iygse+7huCGfoBLeljnXhSYMFot3JdC1zbhhULq5xEM4sSZYCtgmXYyX6qYUKWcjFnKCGQMN5u9GPE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AS4PR04MB9243.eurprd04.prod.outlook.com (2603:10a6:20b:4e2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33; Tue, 18 Jul 2023 09:51:05 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a%5]) with mapi id 15.20.6588.031; Tue, 18 Jul 2023 09:51:04 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 5/5] media: amphion: ensure the bitops don't cross boundaries Date: Tue, 18 Jul 2023 17:50:13 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:4:197::8) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS4PR04MB9243:EE_ X-MS-Office365-Filtering-Correlation-Id: 015a50e9-ba4e-4059-a296-08db87748034 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QC/lYW0mRy9Fb5j13gF30Vtvq3hQiWxPy1+Qg7Z0L5U99cAEJJmvDY20wQdrlon+RvPhiuuw7UUHd2YFum5HYtjVCOcYXYMF/1XMQvvZk76r/09MA5EbUOnyivJUzx66D9Dpvlmx7gzhWXlgoxXGfYJ9aDavkkeJqBpcL5aYrCFM9n2DY6Wmhz7r+zHCO6mPjvkvbM5xk6n6KmCKPIh1au7nSNfjBYcCAaRr0i8rQgOMGTJQxr+84RYX6s+6bxr5kHCzvVFslEfP2CBzf2ZlOowqiaktWPWN5+jLrwisC1zPnO66ol2rhw+M9CjiGLdJZY/4A3+/fTkXbzTQUxpARXrOQuf6pPMMU0nntTKqYifdU0Xs7tuRZhnDYEAqfHSwlgGyWafsiCC0ZknIuh5AtkMtxOWIdwaIl/t7SW5pokp04SS/EuAQQA1KUEpFfbiiLnJLW7ADWXE6KCEXxi/TVJREw30+IVmVFlNgyDeVQD2poYmHBgvCFfmB6sGC42u9lCEQD08evUb8QaAEbRLXPQxnjW7zJ/YjOjsvdKWWwOwOEPsAmQNcp1OsQjv9GCWqRHvBxmtyyzOUvGVHXECwKc6O2LmHujNiiLohS0MLN872lLkUhPYEMzXiZ0ZaZ0bX X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(39860400002)(366004)(136003)(396003)(451199021)(26005)(186003)(6506007)(36756003)(83380400001)(86362001)(38100700002)(38350700002)(2616005)(4326008)(66476007)(66946007)(66556008)(316002)(8936002)(8676002)(5660300002)(7416002)(41300700001)(44832011)(2906002)(6486002)(6666004)(6512007)(52116002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HoyTVk+/VVt2nI1mu4oDvGVAqEE1IQE9ZzVLjYemyIsh6V2cknsKlGPqxmi9VPT5+ZeRf+hwhzw4KnttUX4NynRh5qELCZuvTDHiKjfryf6jc/XQVGdNmNnLCjoh1y5cuFGLOqgeBjimmjpnjPrIRNd89kPX487RA97bdVF6QG6DuefrwXLAbTiBYzVsjCYQz/rIfKYz13SjdsQjOBrglusXQeg4HZ/pRgicNE2wDv7/sTO7RO3QFyvrqyJeE4vRzxgFIS/JEyGP8SEEGycDUJ0foGpsqR9WIt6jfTFmr5cy6/Q4JSj1pD42JX4bJUS/LjBLLD+7D42YNgZujjSfKU/DjU/DeHWAkl0/O3JzmgT9yOeTAxe4HTDElZWRoPFQV+Bin5m/fCLAWP6DILLldS+w1TqC1NmLIW5aIDF145SJBWof7ycO8S5LrHgFZWoFq9LGd8Y7Ie02RmTUoHy5vyPKNA5vM0B8YfIU4TfhM+qypjmLfHH2bzr1r2rcBS75GGF66+HPuyDnsqLXJUhX1buA4RKAvaA0NFbdFlkgbcPOYLPSlxkFVKE0AJyR0Ivm3XLj3lnxq0/jvF0ZUK0h7Cv5JlQXbpKvugV8m0J6tR3T0Epco78w6ou6NfuY8O8mc502+ji3kLE11TAwalb09IjC6ppfIAjrgDFiVKzAKaHy6NV1rEqTKY2huesWYx96vYETkXT+XQ8S0SQ05BYKC/Rw7L6TxS7NRWn3Phta+0sYHQlUQe8KtXcbzb0wMfkWAiNYaVzTHCI3/zF5vz4MJ0kFFTmpNcGgXs06BoB7hNnMbV1jfT4iGVbxp6kMcYhNJ0XgpEQCPZPrfVEPi6TLLb9mULs+tgouueL3yL78QVJDSvvEdfjqRAxZ+hYpVnWV4L1vZ1fNYNZVHJhx7moJY4VDfz91hoQID9Iqo6vhTQKzvOeoZrI1sKBxN1SL3vSJ73ct1Dr0K1MG/RDa7vif3inTqt07mSAS60fQ155ge1Wp/wpoj/1/YoRh9GFLDzMdDaUnRZyX7hNNuHAZ4NPVTVjVTw9VpHcCYOYJfq8N2g8xhkJB92NwkAi88cyQFEirXhqb8enZ+Tq9isS8Z5mfbwqtbra41Ntoe3HeHDuAVsGiMoalXbJEb71sHb+0M78FLKYvqo3HE+5rf71XDC8u9+/hAg1dxj4qg0JTwl2uX7XoOfnllUm3VCVDe3GuKPTAF+a6oulV4m6NVltCg4NB+rF0RUM6EGnwbwRy+J67gDPVfvBU4auueL9iIn3JkQLD4Jrvak0vweIzKiB3ABpVqgfz1J3a0W5K/L0cRCRNYrpredeDr2qgKgmFXKnhYZmAOI77XFJTbEayrLi+zyF/R9JXr/9nSaelKYzf1Qeh6ptsWOAGnO+o/n8kvC9sveJJpJZlrEGSqmil7QQsJU5wkDXX/1JJp7psHTPRDsEvsvsFmHcKhkhTyrXA7VM+uziiGpdOgEXlPpydCFuEYoJ6S0A8uwjwced9WKK013f/sAakGUVvkwXJL+fWJnIoLTD+LKaxzswZjMaNzeBzM/w7lhpCYuHUJBEVIrZi+tBG0oKpqAg2Fp5leSkoL7WGJCHO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 015a50e9-ba4e-4059-a296-08db87748034 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 09:51:04.9083 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 16WIEUkQmofalwWZ+KlMUUXrfltmzo9z19AvRSoKkubKYxmzZnTe2LuoqnEJlFoAgq1lt/+A5tA+WJvW3YpTUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9243 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771752751927879624 X-GMAIL-MSGID: 1771752751927879624 the supported_instance_count determine the instance index range, it shouldn't exceed the bits number of instance_mask, otherwise the bitops of instance_mask may cross boundaries Fixes: 9f599f351e86 ("media: amphion: add vpu core driver") Reviewed-by: Nicolas Dufresne Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vpu_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c index 43d85a54268b..6f054700d5db 100644 --- a/drivers/media/platform/amphion/vpu_core.c +++ b/drivers/media/platform/amphion/vpu_core.c @@ -88,6 +88,8 @@ static int vpu_core_boot_done(struct vpu_core *core) core->supported_instance_count = min(core->supported_instance_count, count); } + if (core->supported_instance_count >= BITS_PER_TYPE(core->instance_mask)) + core->supported_instance_count = BITS_PER_TYPE(core->instance_mask); core->fw_version = fw_version; vpu_core_set_state(core, VPU_CORE_ACTIVE);