Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp420666yba; Thu, 16 May 2019 03:07:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxE5MzKyUP2OamCW7rsg1UTMAYLdNLZjutVlfn7t8NmlL5t8pP+4e7o13NCalvt809HFfVv X-Received: by 2002:a63:2c14:: with SMTP id s20mr32326251pgs.182.1558001279055; Thu, 16 May 2019 03:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558001279; cv=none; d=google.com; s=arc-20160816; b=tR2MtR8jeYKzefTnfjp9/Nf1Gj+JPb9u+ut9eYnryHkrKoaLPjW8+sB9AwcqAj8JfZ BTKLzOFwZoSfH1vrdbrzoueIuknlRRym81k9OFy5YwPNtKecalburoN8EakMpihTJIEe LNv2m4xxqwqb9pgrRzC/h/kFXDIqi7YTX6sT8GAXd/GAlGzLTn1M6SAcX8YmoFwv0ltZ 9cc5JebhCTIR4OgfhTcqaEbsqq9ibD6iYeSNAVcyUFAKyNgClBD0wsVKCmX6qrd1kXjV 01CmUdvt2pPtfQohJmeKY3RbBjJUdudv+7r0EFOxiT2Rc1wb5JP3DmKjh+zYqK3zdlRB +a7w== 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:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=I5vBga45MYiqdpNu7zWqidi/XNYLU95cZZEPhk9WmO0=; b=ks36nSuNrtctXKrXzwxL5W4ktZWsbzRaGXpIJ7cCqJRxKsm1oXtMnp1DpcW9EV2ZG3 9xDMTxZ523268B0D8qGSKdzk1pojSoHybkMaS93R9sPRknN2JOemlfwgyLTejmW5LR4e N9z27KvhSa8AR5JhVvq1Ekg24lnXexXFOlcs8heCgtZhNU5JWnZf3AticWGDOqn1W9J4 p4SvjyFackpjNBU9Bhad51NspLMAW6uhHi3xAOo4BQnpZwirS1ydrbqD/fRPG5AjmMF3 UDHzx6FzgXW8Js5mUgusFJ5RAd0h7RKh4NUf5SXNnXq8IhyzD0AFr8QLyjMje9QW1CyR A/IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=aiqcbv0Z; 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 l15si5164243pfd.285.2019.05.16.03.07.43; Thu, 16 May 2019 03:07:59 -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=@nxp.com header.s=selector2 header.b=aiqcbv0Z; 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 S1726917AbfEPKGi (ORCPT + 99 others); Thu, 16 May 2019 06:06:38 -0400 Received: from mail-eopbgr00088.outbound.protection.outlook.com ([40.107.0.88]:20998 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726336AbfEPKGi (ORCPT ); Thu, 16 May 2019 06:06:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I5vBga45MYiqdpNu7zWqidi/XNYLU95cZZEPhk9WmO0=; b=aiqcbv0Z+2WvwEz3JGM2xtnR+B+92AbYcPHK3Su7+vlWZUUKzChDlOyCw+s3iP5WBiGENcKdxcZ9VmpjfzIzJ0DZesvSWoEG0L38f2BLEnahI8a9H7iohH41sgYrgG1HrTw12CM21DwOWPI0Y1Idnu+y41H7HH63gAtX9dOY294= Received: from AM0PR04MB6434.eurprd04.prod.outlook.com (20.179.252.215) by AM0PR04MB4947.eurprd04.prod.outlook.com (20.177.40.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.17; Thu, 16 May 2019 10:06:34 +0000 Received: from AM0PR04MB6434.eurprd04.prod.outlook.com ([fe80::19be:75a:9fe:7cec]) by AM0PR04MB6434.eurprd04.prod.outlook.com ([fe80::19be:75a:9fe:7cec%7]) with mapi id 15.20.1900.010; Thu, 16 May 2019 10:06:34 +0000 From: Leonard Crestez To: Anson Huang , "shawnguo@kernel.org" CC: "catalin.marinas@arm.com" , "will.deacon@arm.com" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "agross@kernel.org" , "maxime.ripard@bootlin.com" , "olof@lixom.net" , "horms+renesas@verge.net.au" , "jagan@amarulasolutions.com" , "bjorn.andersson@linaro.org" , "marc.w.gonzalez@free.fr" , "dinguyen@kernel.org" , "enric.balletbo@collabora.com" , "l.stach@pengutronix.de" , Aisheng Dong , Abel Vesa , "robh@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: Re: [PATCH V3 1/2] soc: imx: Add SCU SoC info driver support Thread-Topic: [PATCH V3 1/2] soc: imx: Add SCU SoC info driver support Thread-Index: AQHVC5bqk1P5MqRzRU2gqcSUyb18Bw== Date: Thu, 16 May 2019 10:06:34 +0000 Message-ID: References: <1557976777-8304-1-git-send-email-Anson.Huang@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=leonard.crestez@nxp.com; x-originating-ip: [89.37.124.34] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 341301dc-2b6c-4a33-fb56-08d6d9e62d3b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:AM0PR04MB4947; x-ms-traffictypediagnostic: AM0PR04MB4947: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0039C6E5C5 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(346002)(39860400002)(376002)(366004)(199004)(189003)(2906002)(5660300002)(446003)(6436002)(74316002)(476003)(7416002)(71200400001)(6246003)(316002)(55016002)(53936002)(14454004)(9686003)(71190400001)(86362001)(4326008)(25786009)(44832011)(305945005)(229853002)(486006)(256004)(6116002)(3846002)(73956011)(8676002)(81156014)(8936002)(26005)(81166006)(68736007)(2501003)(6506007)(99286004)(7696005)(76176011)(53546011)(102836004)(66066001)(66946007)(66476007)(186003)(33656002)(52536014)(54906003)(110136005)(7736002)(66556008)(91956017)(478600001)(64756008)(76116006)(66446008);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB4947;H:AM0PR04MB6434.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: NK78dy9QOveRvtdyRBZ5mkr3oJhFX0/Ybyz6HvkgdI2u7tA4lJldjYKl/l1/b5IK6CoCgI5v4wBClZIx7blgC/0MOPbCCxPOfxJvspa4l3rzoeEMP1NL958MIrCFVduSMrSAKtKD0T/0Cq7q7UBc96U3rWXp35yZIoCtwLGMvMvSv+nQ06vBBBe1mioyQfUIyyTb7hQ908CavBU+gKhPXE5qxp2E58f6l8qIZkbsLWE3bR0VZd8xqoPaHJorTPOwzecAx/HjMtQ3j2rY3DuXoAyG2TyPb4yC3SKgsdBPQ/HigbDOYtgi0Z7dd2PHETdrhBnPxdoH5kMJ+ZyAGiPqhIKfo1eViCHMJ20NlYP3YP0wywQLLrw/dHoymW1nErSJtf0ja9EGpqFhL67mIHM8mJQn/gOZmp5W9mWqZzQsnWc= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 341301dc-2b6c-4a33-fb56-08d6d9e62d3b X-MS-Exchange-CrossTenant-originalarrivaltime: 16 May 2019 10:06:34.3525 (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: AM0PR04MB4947 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.05.2019 06:24, Anson Huang wrote:=0A= > Add i.MX SCU SoC info driver to support i.MX8QXP SoC, introduce=0A= > driver dependency into Kconfig as CONFIG_IMX_SCU must be=0A= > selected to support i.MX SCU SoC driver, also need to use=0A= > platform driver model to make sure IMX_SCU driver is probed=0A= > before i.MX SCU SoC driver.=0A= =0A= > +#define imx_scu_revision(soc_rev) \=0A= > + soc_rev ? \=0A= > + kasprintf(GFP_KERNEL, "%d.%d", (soc_rev >> 4) & 0xf, soc_rev & 0xf) : = \=0A= > + "unknown"=0A= =0A= > + id =3D of_match_node(imx_scu_soc_match, pdev->dev.of_node);=0A= > + data =3D id->data;=0A= > + if (data) {=0A= > + soc_dev_attr->soc_id =3D data->name;=0A= > + if (data->soc_revision)=0A= > + soc_rev =3D data->soc_revision();=0A= > + }=0A= > +=0A= > + soc_dev_attr->revision =3D imx_scu_revision(soc_rev);=0A= > + if (!soc_dev_attr->revision)=0A= > + return -ENODEV;=0A= =0A= The imx_scu_revision macro returns either kasprintf or "unknown", never =0A= NULL. So it's not clear what this return -ENODEV does exactly.=0A= =0A= It makes more sense to return -ENODEV if get_soc_revision fails, so =0A= maybe check "soc_rev !=3D 0" instead?=0A= =0A= If you really want to check the kasprintf result then you should return =0A= -ENOMEM for it. It would be clearer if you dropped the imx_scu_revision =0A= revision macro and open-coded instead.=0A= =0A= --=0A= Regards,=0A= Leonard=0A=