Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3861755imb; Tue, 5 Mar 2019 22:33:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxb9aZ95jsjIoMFnhQA23hJgib7jnRwA8RuMWEJob+cB0VQDY2iNWr828QN1Zq0z+H8yeQN X-Received: by 2002:a65:6489:: with SMTP id e9mr4900894pgv.260.1551853991587; Tue, 05 Mar 2019 22:33:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551853991; cv=none; d=google.com; s=arc-20160816; b=AfoY94NgzLUq/EB8NzIxnNIDwojiaYr4g3yxgd+QQNAB9ew7A9Zp7kCUAkz+grM5mw DBaus6OdD1t/GQ5Yw1dyYq57YnXA1LV4rZpgvEzeKJ0gccZeN3vlnmcz+KoIIbHb3ScL 5BViJgWHwblZqa0dXzRYYJPrkblAseVKlOF5Ld1AHSkC7uNZHrzVyFQ5/xIWHERcsBIQ 8fZ3mBh+Kg2znHEVA248kKtmgircHHFlClsEVn5KbofWmSYTZlwpsamjgFG4KNRxFIal yGKJ5CW2xc/bGqCFAAFAQz/rHb6qiqxvWGPKRdRkTdOUyOLTyxb0SgWa+/cECbDRi3ID SAJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=ukNEdK0riXpPc10OFBxPv/1trFn2JgPClf9gK6MY3v0=; b=O0eyRuXxib+bhQ+Pbn4RN3pX9p4AOt8FoYVT251CJO7SlmnqBPXRhuTkfOigGI4Wqf 1HM0iaL7fsVAKRvYPESfP89g4TCDeQZ71SLoWBx8GZNZcVQBhtHQ832JL3TqNukaMlet fgW+Fw5Z22mB18BE5jAFhCCIqeQdd1gfK+6PARnahp0LUy1jOuCGvlLaqR9SugWMNfqZ aq0giwbZLJChph+T2GjIlo93XZ1uSpPcylLnmPJZ0ko7L0tOuC5RsvW88el9xVyyTcvl AJgv52q0HbebYHU4O+zO+JaZxOZ28zvJMKhpLd19LalEBo9xMn/dNKHrSPb8togdoC/i l57Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=wC+bPskE; 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bf6si721349plb.106.2019.03.05.22.32.56; Tue, 05 Mar 2019 22:33:11 -0800 (PST) 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=@nxp.com header.s=selector1 header.b=wC+bPskE; 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729100AbfCFGa7 (ORCPT + 99 others); Wed, 6 Mar 2019 01:30:59 -0500 Received: from mail-eopbgr50080.outbound.protection.outlook.com ([40.107.5.80]:11489 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729052AbfCFGa5 (ORCPT ); Wed, 6 Mar 2019 01:30:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ukNEdK0riXpPc10OFBxPv/1trFn2JgPClf9gK6MY3v0=; b=wC+bPskE64ziu39aY4ID+xdBQydvyqPZ+nFsJQJHRd9+hFRaufSsnVFv29vNMN/uXL3i8nvIu1IiP1b4gpYax0G67ZFvyRvqFyCmcdDymGA5Sld+dHExIZpjrxueSnKjiTtG/MYGP9h8Dj0/WDjEvcgJqtdT2XLpHDoubd2PjrY= Received: from AM6PR04MB5016.eurprd04.prod.outlook.com (20.177.34.88) by AM6PR04MB4373.eurprd04.prod.outlook.com (20.177.38.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Wed, 6 Mar 2019 06:30:47 +0000 Received: from AM6PR04MB5016.eurprd04.prod.outlook.com ([fe80::5841:afe:53fd:42bb]) by AM6PR04MB5016.eurprd04.prod.outlook.com ([fe80::5841:afe:53fd:42bb%6]) with mapi id 15.20.1665.020; Wed, 6 Mar 2019 06:30:47 +0000 From: Clark Wang To: "broonie@kernel.org" CC: "linux-spi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH V2 7/8] spi: lpspi: Add the missing NULL check Thread-Topic: [PATCH V2 7/8] spi: lpspi: Add the missing NULL check Thread-Index: AQHU0+Yixo4aIJF2cE68MUX+Dtp80Q== Date: Wed, 6 Mar 2019 06:30:47 +0000 Message-ID: <20190306063020.793-8-xiaoning.wang@nxp.com> References: <20190306063020.793-1-xiaoning.wang@nxp.com> In-Reply-To: <20190306063020.793-1-xiaoning.wang@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR02CA0029.apcprd02.prod.outlook.com (2603:1096:3:18::17) To AM6PR04MB5016.eurprd04.prod.outlook.com (2603:10a6:20b:9::24) x-mailer: git-send-email 2.17.1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=xiaoning.wang@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dc5d0619-4c38-47d2-57c7-08d6a1fd448c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM6PR04MB4373; x-ms-traffictypediagnostic: AM6PR04MB4373: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1;AM6PR04MB4373;23:UjyPGAmDFv7ropkX9H5ySx8LJgzib+ucJYVk5hn?= =?iso-8859-1?Q?ZLNk2oPhpbXcAd+rZYoSzaUjXxqFxV+wizLOVD9aJXdPPHKhtiX2TMmOCp?= =?iso-8859-1?Q?R07ou+hDMj96Hxgxrh6U8f+Qo52fwZxsZ01ufiCiXuPRgSQuuIwlotsUSi?= =?iso-8859-1?Q?s+jl1Mmd1hYR6uX1ARHy8BLwkEX4SNaJoy0XBuJl0gvHaartGOpfBmDQE3?= =?iso-8859-1?Q?/TfzsZ9OH+seKfFsD4J6Vm1CvnpOArSeu+ayRRcFWaU+fR1mrvbFPMV4pK?= =?iso-8859-1?Q?3PAFNqEA0sBFlLLSjl3Qxnfk3pYZD5lUj3a3jrrWTPOE1njpCmc5gRASFu?= =?iso-8859-1?Q?IjLGV86p1VkymUFcHALqjpO8xqcWKZ4osK5Yjc0mDLLypEdqF84mCc9r9y?= =?iso-8859-1?Q?GKBxHKgdm0MrCr8E770OfFQXzsvWhNG2CWx5+UmjSZPrcld9Oanj7tXH3O?= =?iso-8859-1?Q?m6LQed7KJGgnvO4uem0R77P1ZabhfAm1b/0uK+Cvd/F4jg20i/LLyGPNJx?= =?iso-8859-1?Q?IypJ/guNkJ3m0x0tRXelxf9j311zwKn/nqjhgbM31qntPJWFz7BdF9DEoj?= =?iso-8859-1?Q?Q9Hn3lxfUCCqvmzzhIxEfLm9nzVnC4P5DppH1usnlDvPqwED5BkK3JzUWc?= =?iso-8859-1?Q?dTLvJknt5i1keOzXzqdfnVw9EiTWVL/pYcw5smVlvmQ2IcFhA3c48Xh4rM?= =?iso-8859-1?Q?xT1z3RFJLqP85F7MTOvwznautMAH+Bss84S5wPIdL0Gq74n3UqizG0j7vK?= =?iso-8859-1?Q?ElF+g2bmFVudwr0V2SQutB0eM7KdysOKCTq4ymt3H+idU+BIQ3R1z86Hrx?= =?iso-8859-1?Q?XNCxYzN3lFLbFybT6g1ZV5ua7bgzDcma62fMJkHOiRA9P5y2ntyjv4XQcb?= =?iso-8859-1?Q?qIE3zKjCvB0cmwoSexXMPJyxOYUebFLmP1BG60b9UOXvwp9l22TWwQI4D1?= =?iso-8859-1?Q?Y9SDbvAdrkuBEkFoM+tD2MDLCkiafa+NWaoRy7YPOJ5zsc/xR0wfFCfwbX?= =?iso-8859-1?Q?GrT5fjQTVtisdPg/Uz00NnS/gxUNidTnFI0ItKDvfBoSKJK2UuTUIV0ku8?= =?iso-8859-1?Q?yO3TEUfhZHCmmPtlQUIpPN2w/0XYqQBr9bqhSZsCYg4fZdvq/UHk5jm6CY?= =?iso-8859-1?Q?IkDlKlvGbfdEX7glNKsi2PJHvpUUiS2J6G9+ziRoPIzRFHANSXlM0L0Vh9?= =?iso-8859-1?Q?f+RzUPjRjqY7TvbV4vN3TyTx83I40Uof+Sly7SvDkf6MEzsLt1y8rRzS2X?= =?iso-8859-1?Q?3b6sDrMcpjKQC/nhq+b6A6c9DMJRbCeIPak9yNAy+n94tJAE8d8unVVUp5?= =?iso-8859-1?Q?EwLBQwwH2EJW2u5dUs0J0uEc2V6XVsZU0kMdduH7eveQQ=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 0968D37274 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(136003)(376002)(366004)(39860400002)(396003)(199004)(189003)(97736004)(6116002)(386003)(8936002)(6506007)(106356001)(52116002)(1730700003)(8676002)(26005)(81156014)(81166006)(256004)(105586002)(102836004)(50226002)(2501003)(76176011)(99286004)(6512007)(305945005)(71200400001)(6436002)(5640700003)(6486002)(4326008)(53936002)(71190400001)(476003)(25786009)(486006)(66066001)(2616005)(7736002)(186003)(68736007)(446003)(1076003)(11346002)(54906003)(478600001)(316002)(36756003)(6916009)(2351001)(14454004)(86362001)(2906002)(5660300002)(3846002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR04MB4373;H:AM6PR04MB5016.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 8wZNWMtjfAZJBn9ciVRgTaAk3K4O8ieKGsllxELs8lsOHnVbNhDtyLsJs8Y1u1JePjYxeLdoMSninU9uWbcIvPHLnWzfsWyM7qlCqGmP0xh7Ubw+dz6v3/R9iFqcb8T0e4NmrDWHi94qY0SUxhVZr5DpJoMXlozaixGdgc6FqgDieGc0kQHNE0o9rwIPoEUCKnoUaVkAfR1yjcUBSeBpDGJG0ITK6DRIj9OOOf6Z/3WwTr1ijFmkCfjLUGa1cBZ/Mr0d8aJHP9kowOMc0SWhEBZNEJkK0+REn18cVXs/Alf4rJQDRvC+NEVjdbr3XDiQeH9NdBXEmm9FCi52WAk33u1Tf4rOFZz6lT3+LTTMTGuKoc71QsGckZv5hs55rGruZ0KguIKldMBHUHIgcN0/tr4SUotcZqkmMzV4NeOowRg= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc5d0619-4c38-47d2-57c7-08d6a1fd448c X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 06:30:47.4684 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4373 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The spi_transfer *t will be used in one transfer whatever. If t is NULL, there has no need to try sending data, so add an error return here. Signed-off-by: Clark Wang Acked-by: Fugang Duan --- V2: - add this patch in this version --- drivers/spi/spi-fsl-lpspi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index 9ff32fb67a29..2ac3ac5ea50a 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -438,9 +438,12 @@ static int fsl_lpspi_setup_transfer(struct spi_control= ler *controller, struct fsl_lpspi_data *fsl_lpspi =3D spi_controller_get_devdata(spi->controller); =20 + if (t =3D=3D NULL) + return -EINVAL; + fsl_lpspi->config.mode =3D spi->mode; - fsl_lpspi->config.bpw =3D t ? t->bits_per_word : spi->bits_per_word; - fsl_lpspi->config.speed_hz =3D t ? t->speed_hz : spi->max_speed_hz; + fsl_lpspi->config.bpw =3D t->bits_per_word; + fsl_lpspi->config.speed_hz =3D t->speed_hz; fsl_lpspi->config.chip_select =3D spi->chip_select; =20 if (!fsl_lpspi->config.speed_hz) --=20 2.17.1