From patchwork Tue Aug 14 15:57:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todor Tomov X-Patchwork-Id: 144186 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4530942ljj; Tue, 14 Aug 2018 08:57:53 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxro5qyMh8GDV51n/lujk5ejcHD7239j2pel/nzM4f4SeHsIv2BYSC2pVn80m3lK9BerqxL X-Received: by 2002:a63:2506:: with SMTP id l6-v6mr21455382pgl.237.1534262273000; Tue, 14 Aug 2018 08:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534262272; cv=none; d=google.com; s=arc-20160816; b=UU46wfRVDcU2+Cx1CR6RXfdS9Pr9NCNBnGCjjX66fSzfj5IPv+ZDqWVyvIF2asEsiw PXrLYOENnUPhj5l+GdIlSuCuvlMSXgiaKpzBSWNxJdox5uu3ale+5Vw8jp48ZvHQBegw H3Cc4jc1ZZSfJTrzTYKlv2s1WPTsAKQEntd1A/EHU7fZt2/O6E6w8gJUQEF8/w/qvJZr GeT+pkQJP8tU20uZyFt4bUsxa9bCj5l6Cu37hy9+2cZM8qho4XEk3MF+cUevcrO071w1 uPPqF/CnTysqhWfUpIYqhn5gC0AguD5CpSW5Th0s0Faa9vDXo7CMTTp3RlXaC+h7mQ8U S7aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=RT3vAC/8qCljdR1LJcLuUodPPrSwsrklDouWqfMlpTk=; b=dqzFlJRjecYKbx1D/tEdoGm9gv4swp8VR5EAq0yQ4ekUADbeGhs355gyxPYrwJ3BFE OdB3UQtXbkD+HUljW1bQNXZfnVlClFniWkl8JLWs8gRp1iBqtx2jZDA3h35cBokjOJK6 IquCFzi12TUI2W30sHCsVVyYHkT7rnldeW+bfvMozyZEwS38+ITI/tKR5X8+ON5vpmkM nKdmguAfGK/h4S7Y2U0nfoFHNAcqhwDpUIXmf8ztH1RKlj4LZijDR05BVhuklgPunfkk zVfpYscir7Zib6JXSGf2De/GzUplymqqwnX6FLwjRyz2xuFkkx7q5zgw2teTPyuRfUIG eLcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5-v6si21543943pgg.75.2018.08.14.08.57.52; Tue, 14 Aug 2018 08:57:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732232AbeHNSpf (ORCPT + 4 others); Tue, 14 Aug 2018 14:45:35 -0400 Received: from ns.mm-sol.com ([37.157.136.199]:55684 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731882AbeHNSpe (ORCPT ); Tue, 14 Aug 2018 14:45:34 -0400 Received: from mms-0439.qualcomm.mm-sol.com (unknown [37.157.136.206]) by extserv.mm-sol.com (Postfix) with ESMTPSA id 05DD0CD5B; Tue, 14 Aug 2018 18:57:49 +0300 (EEST) From: Todor Tomov To: mchehab@kernel.org, hans.verkuil@cisco.com, linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, arnd@arndb.de, Todor Tomov Subject: [PATCH] media: camss: Use managed memory allocations Date: Tue, 14 Aug 2018 18:57:35 +0300 Message-Id: <1534262255-32270-1-git-send-email-todor.tomov@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use managed memory allocations for structs which are used until the driver is removed. Signed-off-by: Todor Tomov --- drivers/media/platform/qcom/camss/camss-ispif.c | 4 ++-- drivers/media/platform/qcom/camss/camss.c | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/media/platform/qcom/camss/camss-ispif.c index 7f26902..ca7b091 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -1076,8 +1076,8 @@ int msm_ispif_subdev_init(struct ispif_device *ispif, else return -EINVAL; - ispif->line = kcalloc(ispif->line_num, sizeof(*ispif->line), - GFP_KERNEL); + ispif->line = devm_kcalloc(dev, ispif->line_num, sizeof(*ispif->line), + GFP_KERNEL); if (!ispif->line) return -ENOMEM; diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index dcc0c30..3304f7a 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -848,17 +848,18 @@ static int camss_probe(struct platform_device *pdev) return -EINVAL; } - camss->csiphy = kcalloc(camss->csiphy_num, sizeof(*camss->csiphy), - GFP_KERNEL); + camss->csiphy = devm_kcalloc(dev, camss->csiphy_num, + sizeof(*camss->csiphy), GFP_KERNEL); if (!camss->csiphy) return -ENOMEM; - camss->csid = kcalloc(camss->csid_num, sizeof(*camss->csid), - GFP_KERNEL); + camss->csid = devm_kcalloc(dev, camss->csid_num, sizeof(*camss->csid), + GFP_KERNEL); if (!camss->csid) return -ENOMEM; - camss->vfe = kcalloc(camss->vfe_num, sizeof(*camss->vfe), GFP_KERNEL); + camss->vfe = devm_kcalloc(dev, camss->vfe_num, sizeof(*camss->vfe), + GFP_KERNEL); if (!camss->vfe) return -ENOMEM;