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: 10602795 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 01F4D6CB for ; Mon, 17 Sep 2018 13:56:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0A7C29D2B for ; Mon, 17 Sep 2018 13:56:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3B9B29D30; Mon, 17 Sep 2018 13:56:55 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7FEA729D2B for ; Mon, 17 Sep 2018 13:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7EgPy9QxtSi9Va4SeklFa09nBHkWEe5/dSubrIMXvI4=; b=Qp+Vz+je4FYIkl X9HocbOaU7LFsqPLOy31JaGWWwHI2nHfP1Q4P2Nwjn9H2Vzsle5sEEHt5wA+YLm5HUtV55H7s8srX SxlF1JRl3aEoiV9BHLTrbccDAQn+UG4N6CmYayP9oWcM2eTxBg6X23Q/mJxgQkiPrSubGZUi9CuPw q+J3a68lxOsQ5uwXQAeBWCKTeCgOSk4qA0tf/Urg8IiraVRvfhWcvrERGkadXqrvEZbhpumjX5Jps NU0F6EQYh0nnOUXztz/Nvam4rLXwYzGuIUX5EO0NjR2DgLhazE5GA6bvl9chw5woI+RSFaZixs8l4 yWWrcTPuaN+PKtZe0EFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g1u1G-0002Ql-B1 for patchwork-linux-mediatek@patchwork.kernel.org; Mon, 17 Sep 2018 13:56:54 +0000 Received: from aserp2120.oracle.com ([141.146.126.78]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g1u1C-0002Pm-N3 for linux-mediatek@lists.infradead.org; Mon, 17 Sep 2018 13:56:52 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180917_065650_881628_30451091 X-CRM114-Status: GOOD ( 14.55 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Minghsiu Tsai , kernel-janitors@vger.kernel.org, Houlong Wei , linux-mediatek@lists.infradead.org, Matthias Brugger , Mauro Carvalho Chehab , linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.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;