Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp232449imi; Thu, 21 Jul 2022 20:25:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tqBGs04z2Ry0OdT42cwFyWkko8w4CDt6NNapLBSi1kNFykVIcFHW+yYFINuTA1J8HZRYia X-Received: by 2002:a17:902:cccf:b0:168:e13c:5cd9 with SMTP id z15-20020a170902cccf00b00168e13c5cd9mr1416945ple.53.1658460340535; Thu, 21 Jul 2022 20:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658460340; cv=none; d=google.com; s=arc-20160816; b=qV1wnMki6/HlzzL1SZE2WkF7DV/eB9lfL0+UIGif1qk8UxKb5hIattGFlVwX2SGXt+ nVGbLFpeIJ9Tl1Ac3mVIL3A6W54H26OFYAuREC1Q0UIssRDt8V3Sd8KXEo+wIkrGPgNU Gizevh/f65oK0b+OCHV6qUXvxMQhv/5iu+hqrvienukzcWvHWv0Ra0uJ136Lid0o6nqw 74MVRjVb25EVPxppYG24iwWpiBUE+vuYLR5KbWpopYwPo9NEHYEssXffkvjc0dePG12C SDpe81bWex5XUr2+mDhxosK3TYdPh/OX0/p9bQHUljRMzcCgYVqxgtm5igIMxw5Dsb5j mkTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=7cumI2k40Wf2jTZSpS1C8fFLwUssOL1MQc8JznRXgeA=; b=IJk8siBzoBRhuG0pdalRXM8o1YZgqn9xfyaI+ksmcoi84GLVtEva64MdB4kVIKubZO Lb0oe0qzgZ0FDcAgZKR0fiQ0tTCQl9PfPMAmnos+nFTRunm1+y8fe7SibeVuViXh7/+U Myte7EWA3p2dvhNV3G7Z5xR6Bqx40TIx9e48baHKFGUy9AxbrXQU7Tf/klNvRtVVaFaj tkBn4FO6ZIe7RNS7Xgez0ThcnaJ4k+1kh6RuColBE5pnUGM2MbdzOz2H0s7wGL54HssL LYnjoJ++SHlD6S0Y7fa1OK2Os8yg6ITFqG91sEarzHJUKPDwto9y8GADZZVITmJOcPw6 vy1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=H6wJGJMC; 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=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l24-20020a639858000000b0041a5a805ef8si4205674pgo.118.2022.07.21.20.25.25; Thu, 21 Jul 2022 20:25:40 -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=@163.com header.s=s110527 header.b=H6wJGJMC; 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=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230423AbiGVDUb (ORCPT + 99 others); Thu, 21 Jul 2022 23:20:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiGVDU2 (ORCPT ); Thu, 21 Jul 2022 23:20:28 -0400 Received: from mail-m971.mail.163.com (mail-m971.mail.163.com [123.126.97.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8A58C1D0CC; Thu, 21 Jul 2022 20:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=7cumI 2k40Wf2jTZSpS1C8fFLwUssOL1MQc8JznRXgeA=; b=H6wJGJMC7WvNEDD8YHhXS mnYfVaUXUQdPVRhEaZjlPTlZirNDOK5hho/V12T9YVD34wRkF3vpbz1q3kLRXO74 q6ZSWP05WxZcubn4KUCPz34HZqs+NNVCDuJWUPgvnMQxim+Lro5oodXGSyRUOI1J ZXsgl5MsAYmXsarcSb/8yw= Received: from localhost.localdomain (unknown [123.58.221.99]) by smtp1 (Coremail) with SMTP id GdxpCgCXvZQzF9piBKLzPg--.1899S2; Fri, 22 Jul 2022 11:19:16 +0800 (CST) From: williamsukatube@163.com To: ran.wang_1@nxp.com, balbi@kernel.org, linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, William Dean , Hacash Robot Subject: [PATCH] usb: phy: check the return value of ioremap() in usb_otg_start() Date: Fri, 22 Jul 2022 11:19:13 +0800 Message-Id: <20220722031913.2925655-1-williamsukatube@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GdxpCgCXvZQzF9piBKLzPg--.1899S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrtFWrZrW3uFW8Jw13XFW7CFg_yoWfuwb_AF 1rWFyxWrWkGF15Kr17Jryfua4DKw4qvr98XF4vqr98tw1jvF18Xr93Za93WFyUXrWrJFWD Gwn8ZFW8ZF1xWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU5uxRDUUUUU== X-Originating-IP: [123.58.221.99] X-CM-SenderInfo: xzlozx5dpv3yxdwxuvi6rwjhhfrp/1tbiNxRGg1WBo2GhmQAAsI X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 From: William Dean The function ioremap() in usb_otg_start() can fail, so its return value should be checked. Fixes: 0807c500a1a6d ("USB: add Freescale USB OTG Transceiver driver") Reported-by: Hacash Robot Signed-off-by: William Dean --- drivers/usb/phy/phy-fsl-usb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 972704262b02..21b3b2d57358 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -855,6 +855,8 @@ int usb_otg_start(struct platform_device *pdev) * with host/device */ usb_dr_regs = ioremap(res->start, sizeof(struct usb_dr_mmap)); + if (!usb_dr_regs) + return -ENOMEM; p_otg->dr_mem_map = (struct usb_dr_mmap *)usb_dr_regs; pdata->regs = (void *)usb_dr_regs; -- 2.25.1