mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yazen Ghannam <yazen.ghannam@amd.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: yazen.ghannam@amd.com, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, markgross@kernel.org,
	hdegoede@redhat.com, Shyam-sundar.S-k@amd.com,
	linux-edac@vger.kernel.org, clemens@ladisch.de,
	jdelvare@suse.com, linux-hwmon@vger.kernel.org,
	mario.limonciello@amd.com, babu.moger@amd.com
Subject: Re: [PATCH 3/6] hwmon: (k10temp) Check return value of amd_smn_read()
Date: Wed, 17 May 2023 10:04:29 -0400	[thread overview]
Message-ID: <99cab456-5d08-931c-0d59-4415f822c542@amd.com> (raw)
In-Reply-To: <f3cce515-845c-480e-a096-8e24e0079454@roeck-us.net>

On 5/17/23 8:25 AM, Guenter Roeck wrote:

[...]

>>  static long get_raw_temp(struct k10temp_data *data)
>> @@ -213,9 +214,11 @@ static int k10temp_read_temp(struct device *dev, u32 attr, int channel,
>>  				*val = 0;
>>  			break;
>>  		case 2 ... 13:		/* Tccd{1-12} */
>> -			amd_smn_read(amd_pci_dev_to_node_id(data->pdev),
>> -				     ZEN_CCD_TEMP(data->ccd_offset, channel - 2),
>> -						  &regval);
>> +			if (amd_smn_read(amd_pci_dev_to_node_id(data->pdev),
>> +					 ZEN_CCD_TEMP(data->ccd_offset, channel - 2),
>> +					 &regval))
>> +				return -EINVAL;
>> +
> 
> -EINVAL: Invalid Argument, supposed to be used for bad user input.
> I don't see how that would apply here. amd_smn_read() returns
> a valid error code. This error core should be returned to the caller,
> or there needs to be an explanation why this is not appropriate.
>

Understood. Will change it to return the amd_smn_read() error code.

>>  			*val = (regval & ZEN_CCD_TEMP_MASK) * 125 - 49000;
>>  			break;
>>  		default:
>> @@ -373,8 +376,10 @@ static void k10temp_get_ccd_support(struct pci_dev *pdev,
>>  	int i;
>>  
>>  	for (i = 0; i < limit; i++) {
>> -		amd_smn_read(amd_pci_dev_to_node_id(pdev),
>> -			     ZEN_CCD_TEMP(data->ccd_offset, i), &regval);
>> +		if (amd_smn_read(amd_pci_dev_to_node_id(pdev),
>> +				 ZEN_CCD_TEMP(data->ccd_offset, i), &regval))
>> +			continue;
>> +
> The reason for ignoring the error should be explained here.
>

Sure thing. I'll add a code comment above.

Thanks,
Yazen

  reply	other threads:[~2023-05-17 14:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16 20:24 [PATCH 0/6] Enhance AMD SMN Error Checking Yazen Ghannam
2023-05-16 20:24 ` [PATCH 1/6] EDAC/amd64: Remove unused register accesses Yazen Ghannam
2023-05-16 20:24 ` [PATCH 2/6] EDAC/amd64: Check return value of amd_smn_read() Yazen Ghannam
2023-05-16 20:24 ` [PATCH 3/6] hwmon: (k10temp) " Yazen Ghannam
2023-05-17 12:25   ` Guenter Roeck
2023-05-17 14:04     ` Yazen Ghannam [this message]
2023-05-16 20:24 ` [PATCH 4/6] x86/amd_nb: Enhance SMN access error checking Yazen Ghannam
2023-05-16 20:24 ` [PATCH 5/6] hwmon: (k10temp) Define helper function to read CCD temp Yazen Ghannam
2023-05-17 12:30   ` Guenter Roeck
2023-05-17 14:09     ` Yazen Ghannam
2023-05-16 20:24 ` [PATCH 6/6] hwmon: (k10temp) Reduce k10temp_get_ccd_support() parameters Yazen Ghannam
2023-05-17 12:33   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99cab456-5d08-931c-0d59-4415f822c542@amd.com \
    --to=yazen.ghannam@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=babu.moger@amd.com \
    --cc=clemens@ladisch.de \
    --cc=hdegoede@redhat.com \
    --cc=jdelvare@suse.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mario.limonciello@amd.com \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®