From patchwork Mon Sep 17 13:56:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10602797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D904E161F for ; Mon, 17 Sep 2018 13:56:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4D1329D2B for ; Mon, 17 Sep 2018 13:56:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8D7D29D30; Mon, 17 Sep 2018 13:56:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 602E329D2B for ; Mon, 17 Sep 2018 13:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728637AbeIQTYX (ORCPT ); Mon, 17 Sep 2018 15:24:23 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:36272 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726865AbeIQTYX (ORCPT ); Mon, 17 Sep 2018 15:24:23 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w8HDsinn069808; Mon, 17 Sep 2018 13:56:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=2a0Ur+YPmfiiVceJiZXBhy/9Ao4YsMBt34FZ7SpSoXk=; b=gVyeXO4KBtnQAy7oc9rR+Z+rnzAnnCL3GRWL4rdFPWDbr1FTDi+H4pax8ecpMZ4a/lyk 1GG/4xDXJILWvdrrA9bVwD7lS0GnyjVdfwFDStRduD4vem8dxhG54fjih3MtJupmhfUF eHKec7b2TcrRYcq3wCTTnm7QarIinXck4fTdyGGOZs7S56R50rxCugmPfweoYqw71lT+ 1NLN0NCXT4EmYTdrNxAuExxmHvWKWxb6NvYcc3LeYtAH9eaaObaX75XIxkPM9lutVqUh /soU7yCf8WTKYQeer7l5r0ntHtn1RiGifBwA/v7vfbfwZUkKQTLheRJqhdfXnxLf3fT0 Eg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2mgt1peb39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Sep 2018 13:56:34 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w8HDuWMt012328 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Sep 2018 13:56:32 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w8HDuU7C022802; Mon, 17 Sep 2018 13:56:32 GMT Received: from mwanda (/197.232.248.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 17 Sep 2018 06:56:30 -0700 Date: Mon, 17 Sep 2018 16:56:22 +0300 From: Dan Carpenter To: Tiffany Lin , Andrew-CT Chen Cc: Minghsiu Tsai , Houlong Wei , Mauro Carvalho Chehab , Matthias Brugger , linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org, kernel-janitors@vger.kernel.org Subject: [PATCH] [media] VPU: mediatek: don't pass an unused parameter Message-ID: <20180917135622.GA23073@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9018 signatures=668708 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809170142 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The load_requested_vpu() function returns a freed vpu_fw pointer. It's not used so it doesn't cause any problems, but Smatch complains about it: drivers/media/platform/mtk-vpu/mtk_vpu.c:578 vpu_load_firmware() warn: passing freed memory 'vpu_fw' We can clean up the code a bit and silence the static checker warning by not passing the parameter at all. Signed-off-by: Dan Carpenter diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c index f8d35e3ac1dc..616f78b24a79 100644 --- a/drivers/media/platform/mtk-vpu/mtk_vpu.c +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c @@ -480,12 +480,12 @@ EXPORT_SYMBOL_GPL(vpu_get_plat_device); /* load vpu program/data memory */ static int load_requested_vpu(struct mtk_vpu *vpu, - const struct firmware *vpu_fw, u8 fw_type) { size_t tcm_size = fw_type ? VPU_DTCM_SIZE : VPU_PTCM_SIZE; size_t fw_size = fw_type ? VPU_D_FW_SIZE : VPU_P_FW_SIZE; char *fw_name = fw_type ? VPU_D_FW : VPU_P_FW; + const struct firmware *vpu_fw; size_t dl_size = 0; size_t extra_fw_size = 0; void *dest; @@ -539,7 +539,6 @@ int vpu_load_firmware(struct platform_device *pdev) struct mtk_vpu *vpu; struct device *dev = &pdev->dev; struct vpu_run *run; - const struct firmware *vpu_fw = NULL; int ret; if (!pdev) { @@ -568,14 +567,14 @@ int vpu_load_firmware(struct platform_device *pdev) run->signaled = false; dev_dbg(vpu->dev, "firmware request\n"); /* Downloading program firmware to device*/ - ret = load_requested_vpu(vpu, vpu_fw, P_FW); + ret = load_requested_vpu(vpu, P_FW); if (ret < 0) { dev_err(dev, "Failed to request %s, %d\n", VPU_P_FW, ret); goto OUT_LOAD_FW; } /* Downloading data firmware to device */ - ret = load_requested_vpu(vpu, vpu_fw, D_FW); + ret = load_requested_vpu(vpu, D_FW); if (ret < 0) { dev_err(dev, "Failed to request %s, %d\n", VPU_D_FW, ret); goto OUT_LOAD_FW;