]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
powerpc/pseries: Add failure related checks for h_get_mpp and h_get_ppp
authorShrikanth Hegde <sshegde@linux.ibm.com>
Fri, 12 Apr 2024 09:20:47 +0000 (14:50 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 29 Apr 2024 13:51:15 +0000 (23:51 +1000)
Couple of Minor fixes:

- hcall return values are long. Fix that for h_get_mpp, h_get_ppp and
parse_ppp_data

- If hcall fails, values set should be at-least zero. It shouldn't be
uninitialized values. Fix that for h_get_mpp and h_get_ppp

Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240412092047.455483-3-sshegde@linux.ibm.com
arch/powerpc/include/asm/hvcall.h
arch/powerpc/platforms/pseries/lpar.c
arch/powerpc/platforms/pseries/lparcfg.c

index a41e542ba94dd939782c0b0fbd1e606b4208ff0e..51172625fa3a5fc352f6bc8cb8f499e19433a115 100644 (file)
@@ -570,7 +570,7 @@ struct hvcall_mpp_data {
        unsigned long backing_mem;
 };
 
-int h_get_mpp(struct hvcall_mpp_data *);
+long h_get_mpp(struct hvcall_mpp_data *mpp_data);
 
 struct hvcall_mpp_x_data {
        unsigned long coalesced_bytes;
index 4e9916bb03d71fb687f49c989b7f65cce08bd066..c1d8bee8f7018ce582ab95ca2db8fa2d56741aa0 100644 (file)
@@ -1886,10 +1886,10 @@ out:
  * h_get_mpp
  * H_GET_MPP hcall returns info in 7 parms
  */
-int h_get_mpp(struct hvcall_mpp_data *mpp_data)
+long h_get_mpp(struct hvcall_mpp_data *mpp_data)
 {
-       int rc;
-       unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
+       unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
+       long rc;
 
        rc = plpar_hcall9(H_GET_MPP, retbuf);
 
index 679efcf21628427f3b2b62ca677f218ace546a4c..6e7029640c0ca2f1f9aad9ec95104e45680cf93a 100644 (file)
@@ -113,8 +113,8 @@ struct hvcall_ppp_data {
  */
 static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
 {
-       unsigned long rc;
-       unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
+       unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
+       long rc;
 
        rc = plpar_hcall9(H_GET_PPP, retbuf);
 
@@ -197,7 +197,7 @@ static void parse_ppp_data(struct seq_file *m)
        struct hvcall_ppp_data ppp_data;
        struct device_node *root;
        const __be32 *perf_level;
-       int rc;
+       long rc;
 
        rc = h_get_ppp(&ppp_data);
        if (rc)