diff mbox series

mtd: hyperbus: Add proper error message for missing compatible

Message ID 20200203075531.3739-1-dirk.behme@de.bosch.com
State Superseded
Delegated to: Vignesh R
Headers show
Series mtd: hyperbus: Add proper error message for missing compatible | expand

Commit Message

Behme Dirk (CM/ESO2) Feb. 3, 2020, 7:55 a.m. UTC
In case the compatible "cypress,hyperflash" is not given
output a proper error message. Do it the same way as some
lines above.

Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
---
 drivers/mtd/hyperbus/hyperbus-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Sergei Shtylyov Feb. 3, 2020, 6:37 p.m. UTC | #1
On 02/03/2020 10:55 AM, Dirk Behme wrote:

> In case the compatible "cypress,hyperflash" is not given
> output a proper error message. Do it the same way as some
> lines above.
> 
> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
> ---
>  drivers/mtd/hyperbus/hyperbus-core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/hyperbus/hyperbus-core.c b/drivers/mtd/hyperbus/hyperbus-core.c
> index 6af9ea34117d..61b0f686a6dc 100644
> --- a/drivers/mtd/hyperbus/hyperbus-core.c
> +++ b/drivers/mtd/hyperbus/hyperbus-core.c
> @@ -73,8 +73,10 @@ int hyperbus_register_device(struct hyperbus_device *hbdev)
>  
>  	np = hbdev->np;
>  	ctlr = hbdev->ctlr;
> -	if (!of_device_is_compatible(np, "cypress,hyperflash"))
> +	if (!of_device_is_compatible(np, "cypress,hyperflash")) {
> +		pr_err("hyperbus: 'cypress,hyperflash' compatible missing\n");

   Traditionally, the string prop values are enclosed in "", not ''.

MBR, Sergei
Raghavendra, Vignesh Feb. 4, 2020, 4:46 a.m. UTC | #2
Hi,

On 04/02/20 12:07 am, Sergei Shtylyov wrote:
> On 02/03/2020 10:55 AM, Dirk Behme wrote:
> 
>> In case the compatible "cypress,hyperflash" is not given
>> output a proper error message. Do it the same way as some
>> lines above.
>>
>> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
>> ---
>>  drivers/mtd/hyperbus/hyperbus-core.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mtd/hyperbus/hyperbus-core.c b/drivers/mtd/hyperbus/hyperbus-core.c
>> index 6af9ea34117d..61b0f686a6dc 100644
>> --- a/drivers/mtd/hyperbus/hyperbus-core.c
>> +++ b/drivers/mtd/hyperbus/hyperbus-core.c
>> @@ -73,8 +73,10 @@ int hyperbus_register_device(struct hyperbus_device *hbdev)
>>  
>>  	np = hbdev->np;
>>  	ctlr = hbdev->ctlr;
>> -	if (!of_device_is_compatible(np, "cypress,hyperflash"))
>> +	if (!of_device_is_compatible(np, "cypress,hyperflash")) {
>> +		pr_err("hyperbus: 'cypress,hyperflash' compatible missing\n");
> 
>    Traditionally, the string prop values are enclosed in "", not ''.
> 

Also, please use dev_err() here. ctlr->dev should have a valid device
pointer at this point.
diff mbox series

Patch

diff --git a/drivers/mtd/hyperbus/hyperbus-core.c b/drivers/mtd/hyperbus/hyperbus-core.c
index 6af9ea34117d..61b0f686a6dc 100644
--- a/drivers/mtd/hyperbus/hyperbus-core.c
+++ b/drivers/mtd/hyperbus/hyperbus-core.c
@@ -73,8 +73,10 @@  int hyperbus_register_device(struct hyperbus_device *hbdev)
 
 	np = hbdev->np;
 	ctlr = hbdev->ctlr;
-	if (!of_device_is_compatible(np, "cypress,hyperflash"))
+	if (!of_device_is_compatible(np, "cypress,hyperflash")) {
+		pr_err("hyperbus: 'cypress,hyperflash' compatible missing\n");
 		return -ENODEV;
+	}
 
 	hbdev->memtype = HYPERFLASH;