Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11754080ybi; Thu, 25 Jul 2019 23:00:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDizgTyayxsKce+CI0cyvtggCYTB8buZPJk8r6mNSzanisE2wDy7iSH05JRD8zhZk7dVEA X-Received: by 2002:a63:2cd1:: with SMTP id s200mr85501344pgs.10.1564120800656; Thu, 25 Jul 2019 23:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564120800; cv=none; d=google.com; s=arc-20160816; b=g5heJxh6gYT3wWhXL8UOsxdAil6JBvJQO2tEp/DDasEPeUwDECcQTRvUfbbvcu1Fk3 w0jdO5FXtqRHsOP2vItDzJgU1BR3w5KeaGdcT0GjlR4WtV7tu0zUTe3Dui1yU/w8HGLY I5RJz86pZ5GZTo4pALVc7r3RJeBY3rUIdZFwCMKtqJ/hKDc+/slcwl8kUb75ySmCnBzm Ww/r+gVFRBcgArJaqaYAYoOzpE4pPOjLuo1qY1PZ4H/0ja2J4N6jt0VQWw+hfPTpm7Yz TQYFenL9OQX2R24jNh7KAHxSEBaee2hR1gzFsj5kbRDyriRBjLVD+MEpuKi9aSvKe9/L +ucA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=ErugISPirnKvirb7kfKdOt8nulUs9x9jbhrtQhmfxDQ=; b=nVBqefapp/wdAC/l5bFWs9oX8zMGDQVlIOe+lSBIFGDWiwYLtfZ5G28cv+uEqtMCN7 m7+bNbqJP57LvGusrbMUB+Y7I28JwjkhkbXIpHckJjyqCuWtj7oeL8fkAb2hgS15Pt6V 3D0ftPpsnfNZETWwcswvcKlQ0mLUqo5nNnj9G9tZULj9ZOqAi4xnezO4yznyPITW51rJ zPhXy3AA0jh6KpftAYwmC3B4HqEc13h581jhM7NOFJ/fntiVPcy+F+lMMLZVgVMN34A2 y+eWrrUVGwoiiIw6geQDeNAmMJhaqiAD6pnu3hg/kgvnzcv2O+d95f2u1Jla86pVdzdz oJxQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si19965057pgo.511.2019.07.25.22.59.29; Thu, 25 Jul 2019 23:00:00 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726109AbfGZF5a (ORCPT + 99 others); Fri, 26 Jul 2019 01:57:30 -0400 Received: from mga01.intel.com ([192.55.52.88]:39876 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725842AbfGZF5a (ORCPT ); Fri, 26 Jul 2019 01:57:30 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 22:57:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,309,1559545200"; d="scan'208";a="254223291" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.122]) ([10.237.72.122]) by orsmga001.jf.intel.com with ESMTP; 25 Jul 2019 22:57:26 -0700 Subject: Re: [PATCH v2 2/2] mmc: Add support for the ASPEED SD controller To: Andrew Jeffery , linux-mmc Cc: Ulf Hansson , Rob Herring , mark.rutland@arm.com, Joel Stanley , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Ryan Chen References: <20190712033214.24713-1-andrew@aj.id.au> <20190712033214.24713-3-andrew@aj.id.au> <7cd30f3d-43fd-42da-9301-091eb2625c65@www.fastmail.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <8a7bfe52-83ca-7601-7d75-e5615da7b5de@intel.com> Date: Fri, 26 Jul 2019 08:56:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <7cd30f3d-43fd-42da-9301-091eb2625c65@www.fastmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/07/19 3:52 AM, Andrew Jeffery wrote: > On Thu, 25 Jul 2019, at 22:49, Adrian Hunter wrote: >> On 12/07/19 6:32 AM, Andrew Jeffery wrote: >>> +static int aspeed_sdhci_probe(struct platform_device *pdev) >>> +{ >>> + struct sdhci_pltfm_host *pltfm_host; >>> + struct aspeed_sdhci *dev; >>> + struct sdhci_host *host; >>> + struct resource *res; >>> + int slot; >>> + int ret; >>> + >>> + host = sdhci_pltfm_init(pdev, &aspeed_sdc_pdata, sizeof(*dev)); >>> + if (IS_ERR(host)) >>> + return PTR_ERR(host); >>> + >>> + pltfm_host = sdhci_priv(host); >>> + dev = sdhci_pltfm_priv(pltfm_host); >>> + dev->parent = dev_get_drvdata(pdev->dev.parent); >>> + >>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >>> + slot = aspeed_sdhci_calculate_slot(dev, res); >>> + if (slot < 0) >>> + return slot; >>> + dev_info(&pdev->dev, "Configuring for slot %d\n", slot); >>> + dev->width_mask = !slot ? ASPEED_SDC_S0MMC8 : ASPEED_SDC_S1MMC8; >> >> That implies that you only support 2 slots which begs the question why >> you don't validate slot. > > I'm not sure what you mean here, but I'll dig into it. I just meant, if you only support 2 slots: if (slot > 1) return -EINVAL;