Message ID | 20190604104455.8877-8-lee.jones@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp5668048ili; Tue, 4 Jun 2019 03:45:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxgrMBvJAD86AzrIx5HxgkC0HL0UbyxjCrp08ZO6hNqbSndNkQJ5mANxoz5pZt6Ivo7jJa X-Received: by 2002:a63:4e10:: with SMTP id c16mr34046882pgb.214.1559645110873; Tue, 04 Jun 2019 03:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559645110; cv=none; d=google.com; s=arc-20160816; b=P/F05XskhrUU5e+E7U9ox0wYjbueJlrgGrsddJuprnKu8clTyzNqwJAvjw5BOrwFg8 t07sxTeuXzFUGLimk/vsA3IqFUp1YEfM1xnn4IHGmi359tg8XRY/dodmElBi1dFqxVEt 1fr3zCsEPF8ZG7tScbSohAtwlokjGu+4lcRc5zH4L2+odId2mvwZyLj/1iqMFlqjTvH3 Cg/rfpMNrj65ctxHYotW/r0Sq07+tru35B07TLZGT/OKRC+CJSh2bFyYpiGBUkajh5Ep KispXlYN8/dSieQuTtG+s9ddIJT59kXhlodRnZkBJbk80w81yx3ZKSDiwtHfdTAPoLtD hXDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=MkGVFZY1XhtlH3EXbDSeWCPiZrbaYk4zwPdOeyiIsNc=; b=oO0+8nSEKcqLQ0QvDsf3dRCfiuKoIQaLWhjvgIgOTXkp7aSrZHpIRCYIWCxY82XpjP Wnvk9tFhn2KOfHLz4CKjrSrgxv0HQHVf+/GrDpIrPcOtosjRPx4ZBsfrD4fNXEbHH/Qt t8CyvCRt8Q0TQtnhX+iUk4m1KYXyUtJ1gJew9SRUxWrK7RIoTExWE0PZNDmCSyfJJDrK W33iK0VXpBsZPQ5bNU7JyspuQXwVjGhCmi6YIeJvzaEJJxHB/tJ+21+1CgAhQKLvfJ7J K2i/mM4XqbIH6w70u0LnvLQps3hMDStKiDpwe//QNxrsUoIMnj2WfJEm3/5B5LOicHSl nMfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hljw8RsT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v23si11740119plo.34.2019.06.04.03.45.10; Tue, 04 Jun 2019 03:45:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hljw8RsT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727509AbfFDKpK (ORCPT <rfc822;mike.holmes@linaro.org> + 30 others); Tue, 4 Jun 2019 06:45:10 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:43235 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727483AbfFDKpI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 4 Jun 2019 06:45:08 -0400 Received: by mail-wr1-f66.google.com with SMTP id r18so6266056wrm.10 for <linux-kernel@vger.kernel.org>; Tue, 04 Jun 2019 03:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MkGVFZY1XhtlH3EXbDSeWCPiZrbaYk4zwPdOeyiIsNc=; b=hljw8RsTFEcbuplHCj6D4tq/5nIpPFTXoAK24WDaO16R2lM4A4tkIl52AnrPf6JXw1 gT3EjpICXK9lQrDnqMtsHhdKD3i45MO0tlSwTZkOGsLnygeqnS1GEq42hVT5+HlqpNGw T+gYf8t0vIU7HSEAEdNBmet5opXalvHQjYcEdfz/km30EDtQQfXPpL8nTAL5/46rMhak gMuexpRELw1yz4AqSHcBpII97mOzlQXjdBv9q9uxJg0vY4L2Wkz4mWfTGT41kUyPjWyf oCCUVzTVMMLzv8BuVscDTyHO0HMHqetsCPsptCOLxfHbS+xv6PqNZFqqiN1cTF5Ezas/ RETA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MkGVFZY1XhtlH3EXbDSeWCPiZrbaYk4zwPdOeyiIsNc=; b=l57Av9MD36F8vgWBE/ptZ9fmK2/SEdk4v1qGWsguPE0s14/jkEXAxwLDzbFvbmoyC/ /FpWUjzlEHYzdy7PiaSoKiazMC05Rqb7PoxoHtkvJrSNiaKJkn19GNnqY12D+JNydVkY k22teemySCgHVafnWg2enBPJIC74NwD1Krn8yQyO2rEkFs+HSwDva4LJ1U6h/rEHes70 i4GIodroZBYRkv8rGmeFMr8CtOdolCSdRFwYZHDhmx8oJ0/ECiRwJazT8ecEZqqXIqMh fEzfoeHd6RaDecy+2Xtd+yycDXJtkleV1Of5P4KnYMOSqu7RxAcNdzDs5wvV/cLTNToh ahjg== X-Gm-Message-State: APjAAAWhroxCPScAyycjIeuelG0ovpG/bo0JifwPCh54PcEZCeQspSYT dZ/Yft328vxsEhMpKHnvNHDngw== X-Received: by 2002:adf:a38d:: with SMTP id l13mr13613323wrb.187.1559645107190; Tue, 04 Jun 2019 03:45:07 -0700 (PDT) Received: from localhost.localdomain ([2.27.167.43]) by smtp.gmail.com with ESMTPSA id t140sm2718623wmt.0.2019.06.04.03.45.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 03:45:06 -0700 (PDT) From: Lee Jones <lee.jones@linaro.org> To: alokc@codeaurora.org, kramasub@codeaurora.org, andy.gross@linaro.org, david.brown@linaro.org, wsa+renesas@sang-engineering.com, bjorn.andersson@linaro.org, linus.walleij@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jlhugo@gmail.com, linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-usb@vger.kernel.org, Lee Jones <lee.jones@linaro.org> Subject: [PATCH 8/8] usb: dwc3: qcom: Improve error handling Date: Tue, 4 Jun 2019 11:44:55 +0100 Message-Id: <20190604104455.8877-8-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604104455.8877-1-lee.jones@linaro.org> References: <20190604104455.8877-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index f21fdd6cdd1a..633482926497 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -419,6 +419,9 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) if (!count || ACPI_HANDLE(dev)) return 0; + if (count < 0) + return count; + qcom->clks = devm_kcalloc(dev, qcom->num_clocks, sizeof(struct clk *), GFP_KERNEL); if (!qcom->clks)
dwc3_qcom_clk_init() is called with of_count_phandle_with_args() as an argument. If of_count_phandle_with_args() returns an error, the number of clocks will be a negative value and will lead to undefined behaviour. Ensure we check for an error before attempting to blindly use the value. Signed-off-by: Lee Jones <lee.jones@linaro.org> --- drivers/usb/dwc3/dwc3-qcom.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1